SFML community forums
Help => Graphics => Topic started by: lorence30 on June 02, 2015, 07:43:06 pm
-
Hello, im making my 2D side scroller game. (super mario)
sorry for my english.
i dont know if i did it right,
first ,if mario is in the middle position and then he moves forward the "background will move", while background is moving mario will still be in the middle position until he moves back.
second, how about the obstacles that arent yet visible in the screen? should i make the background to, like, window.getSize().x * 50000 pixels? and then put the obstacles and the enemies there at the beginning of the program? and if theyre already visible in screen i will start to make them move?
or any ideas?
thanks.
-
For something blocky like mario, I'd suggest using a 2d array for collision detection and having lots of images which are each the default size of the window, then either displaying one or two of them, depending on how far you'e scrolled.Basically, you draw the whole level as one image, then load a rectangle for each amount that is displayable at a time. Either that or use a sprite/texture per type of block.
-
I'd suggest using a 2d array for collision detection
yea, i always use 2d array fo collision detection for any games
and having lots of images which are each the default size of the window, then either displaying one or two of them, depending on how far you'e scrolled.Basically, you draw the whole level as one image, then load a rectangle for each amount that is displayable at a time. Either that or use a sprite/texture per type of block.
okay thanks for idea