Monkeychow wrote:
Mmh, this should actually work. What exactly do you mean by
global variable?
Usually you should have your game object defined static in your main class anyway. So why don't just use this?
Both methods should work to get the desired effect but look rather ugly

I'm trying to make a game where if you walk up off screen, you appear at the coordinate 0 on the next screen, with the same x coord
To do this I set a variable like so:
Code:
public class Game extends StateBasedGame {
public static float Xcord;
//states
public static final int menu = 0;
public static final int play = 1;
public static final int options = 2;
public static final int thanks = 3;
public static final int opening = 4;
public static final int level2A = 5;
public static final int level2B = 6;
}
and then setting that variable in one state in the update method
and then saying the character starts at or is rendered at (Xcord,0);
however, when the game transitions between states, it sets the Xcord back the value it is set innitialls appose to what I set in the playing state before it.
I'm just wondering how I go about stopping this.