Skip to main content
gamedev.net
🔒 Locked

problem with java game !!

Started by prof_89 1 reply 500+ views
Original Post
prof_89
prof_89
Hi, i have a problem with my beginning of an RPG game... But if you try the game you can see that you get stuck almost everywhere in the map, you can also walk on the water... anyone knows why? Link to game, sourcecode + whole package of game http://www.freewebs.com/prof_89/appletgame/spel.html - Där finns appleten med så långt vi kommit - "alla filer" is the package with all game content thanks in advance //jonathan [Edited by - prof_89 on January 26, 2007 4:06:07 AM]
Wai
Wai
In your check function, I think you flipped the xy positions:

public void check(String dir){			int check_left = Player_x-1;			int check_right= Player_x+1;			int check_up   = Player_y-1;			int check_down = Player_y+1;		if( dir == "left" ){			if(	coll_map[Player_y][check_left] != 1 )			{				player = playerLeft;				x-=speed;				repaint(x, y, 20, 40);				repaint(x+20, y, 20, 40);			}		}		if( dir == "right" ){			if(	coll_map[Player_y][check_right] != 1 )			{				player = playerRight;				x+=speed;				repaint(x, y, 20, 40);				repaint(x-20, y, 20, 40);			}		}		if( dir == "up" ){				if(	coll_map[Player_x][check_up] != 1 ) { player = playerUp;					y-=speed; repaint(x, y, 20, 40); repaint(x,y+20,20,40);}		}		if( dir == "down" ){				if(	coll_map[Player_x][check_down] != 1 ) { player = playerDown;					y+=speed; repaint(x, y, 20, 40); repaint(x,y-20,20,40);}		}	}

For left and right, you put Player_y in the x index
prof_89
prof_89

well, you were almost right... but my x and y coordinates are litte wierd, but thanks to you i noticed...

i had to put the Player_x in the y field...dont really know why but it works so..

thank you so much :P

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.