[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - MarteEngine

Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 30, 2023 9:14 pm

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 171 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12
Author Message
 Post subject: can't use Camera :(
PostPosted: Thu Nov 01, 2012 5:10 pm 
Offline

Joined: Wed Oct 24, 2012 2:31 pm
Posts: 17


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Thu Nov 01, 2012 11:32 pm 
Offline
Regular

Joined: Mon Dec 08, 2008 2:17 pm
Posts: 160


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Fri Nov 02, 2012 3:18 am 
Offline

Joined: Thu Aug 30, 2012 12:13 am
Posts: 43
Thank You So Much Stef! You Are A Life Saver! :D


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Fri Nov 02, 2012 6:51 am 
Offline

Joined: Thu Aug 30, 2012 12:13 am
Posts: 43


Top
 Profile  
 
 Post subject: Woot ? it Worked :P
PostPosted: Fri Nov 02, 2012 12:34 pm 
Offline

Joined: Wed Oct 24, 2012 2:31 pm
Posts: 17
Thanks Stef :)
that new updated version worked just fine for me.
and side-scrolling is also smooth
however when i press jump and run than hero jumps smooth but when coming down camera trys to center hero and the hero goes a little back and the scence stops and ruins the smooth-ness

EDIT :: Solved ..
just had to put this line in update method
camera.follow(hero, CameraFollowStyle.TOPDOWN);

Thanks a lot for this awesome library :)


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Wed Feb 19, 2014 10:17 am 
Offline

Joined: Tue Feb 18, 2014 5:05 pm
Posts: 1
Hi all. Im following the tutorials on the ME wiki and Im stuck at the input tutorial - it doesnt work for me in the Player and Level class - it only works in the HelloWorld Class using the slick2d methods for input. Can you point out my mistake ? Here are my classes following the tutorials.
[code]
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
* Launch Hello World example
**/
public class HelloWorldTest extends StateBasedGame {

public HelloWorldTest(String title) {
super(title);
}

@Override
public void initStatesList(GameContainer container) throws SlickException {
// add HelloWorld to current game with id 1
addState(new HelloWorld(1, container));
}

public static void main(String[] argv) {
try {
AppGameContainer container = new AppGameContainer(new HelloWorldTest(
"Hello World Marte Engine"));
container.setDisplayMode(800, 600, false);
container.setTargetFrameRate(60);
container.start();

} catch (SlickException e) {
e.printStackTrace();
}
}

}
========
import it.randomtower.engine.World;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

//import it.randomtower.engine.World;

//slick input works

public class HelloWorld extends World {
private Image img;
private boolean one = false;
public HelloWorld(int id, GameContainer container) throws SlickException {
super(id, container);

img = new Image("data/Alien.png");
}


@Override
public void render(GameContainer container, StateBasedGame stateBasedGame, Graphics g)
throws SlickException {
super.render(container,stateBasedGame,g);

g.drawString("Hello World", 300, 200);
img.draw(100, 100, 0.2f);
// if (one) g.drawString("one pressed", 100, 100);
}


@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
// TODO Auto-generated method stub
super.init(container, game);

}


@Override
public void update(GameContainer arg0, StateBasedGame arg1, int arg2)
throws SlickException {
// TODO Auto-generated method stub
super.update(arg0, arg1, arg2);
Input in = container.getInput();
// if(in.isKeyDown(Input.KEY_1)) one = true;
// if(in.isKeyDown(Input.KEY_4)) System.out.println("4 pressed");

}

}
============
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;

import it.randomtower.engine.entity.Entity;

//no input works

public class Player extends Entity {

/**
* @param x, x coordinate on screen where Player starts
* @param y, y coordinate on screen where Player starts
* @throws SlickException
*/


public Player(float x, float y) throws SlickException {
super(x, y);
// load Image from disk and associate it as player image
Image img = new Image("data/Alien.png");
setGraphic(img);

// define a command to handle input
define("RIGHT", Input.KEY_RIGHT);
}

@Override
public void update(GameContainer container, int delta) throws SlickException {
// TODO Auto-generated method stub
super.update(container, delta);
// check if a key is down
if(check("RIGHT")){
// do anything you like, for example:
x = x+10;
System.out.println("right pressed!");

}

// Input in = container.getInput();


// if(in.isKeyDown(Input.KEY_2)) System.out.println("2 is pressed!");

}


@Override
public void render(GameContainer arg0, Graphics arg1) throws SlickException {
// TODO Auto-generated method stub
super.render(arg0, arg1);
}



}
==========
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import it.randomtower.engine.ME;
import it.randomtower.engine.World;

import it.randomtower.engine.entity.Entity;

//slick input not working

public class Level extends World {
private boolean five = false;
/**
* @param id, unique identifier for World
* @param container, container for World
*/
public Level(int id, GameContainer container) {
super(id, container);
// TODO Auto-generated constructor stub


}

@Override
public void add(Entity e) {
// TODO Auto-generated method stub
super.add(e);
}

@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
super.init(container, game);

Player player = new Player(100,100);
add(player) ;// cant resolve World.GAME as in the tutorial


}

@Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
super.update(container, game, delta);
Input in = container.getInput();

if(in.isKeyDown(Input.KEY_5)) {
five = true;
}
}

@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
super.render(container, game, g);
if(five) System.out.println("five!");
}



}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 171 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group