Computer Science Canada

Sprite remaining in middle, screen moving

Author:  Crupe32 [ Mon Dec 21, 2015 8:36 pm ]
Post subject:  Sprite remaining in middle, screen moving

What is it you are trying to achieve?
I want to create a game for my final project where the sprite stays in the middle of the screen, and when the user clicks an arrow, it moves the screen instead of the sprite, yet the sprite moving animations still take place

Author:  Insectoid [ Tue Dec 22, 2015 6:04 am ]
Post subject:  RE:Sprite remaining in middle, screen moving

Do you know how to do the opposite, make a sprite move and everything else stay stationary?

Author:  Crupe32 [ Tue Dec 22, 2015 12:39 pm ]
Post subject:  Re: Sprite remaining in middle, screen moving

yes, with KEY_UP_ARROW (or anything else) and a couple of variables,, I can move my sprites.. However I am not sure i know how to make the screen move if it reaches the edge of the screen either.

Author:  Insectoid [ Tue Dec 22, 2015 2:03 pm ]
Post subject:  RE:Sprite remaining in middle, screen moving

Don't think of it as moving the screen, think of it as moving every image on the screen except the character. All of those images, rectangles, circles, whatever, all have x and y coordinates that you can change just like your character does.

Author:  Crupe32 [ Wed Dec 23, 2015 4:55 pm ]
Post subject:  Re: Sprite remaining in middle, screen moving

I think i understand, so say, each time key=true and chars=KEY_UP_ARROW all things on screen are (spritey+5)?

Author:  Insectoid [ Wed Dec 23, 2015 8:13 pm ]
Post subject:  RE:Sprite remaining in middle, screen moving

Sure, though instead of 'spritey', you might try a more descriptive variable name, like 'backgroundX'.

Author:  Crupe32 [ Fri Dec 25, 2015 3:14 pm ]
Post subject:  Re: Sprite remaining in middle, screen moving

any idea on how I can make the background move as your character moves though?

Author:  Insectoid [ Fri Dec 25, 2015 3:50 pm ]
Post subject:  RE:Sprite remaining in middle, screen moving

Quote:
each time key=true and chars=KEY_UP_ARROW all things on screen are (spritey+5)?


: