Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sprite remaining in middle, screen moving
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Crupe32




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: 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?
Crupe32




PostPosted: 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.
Insectoid




PostPosted: 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.
Crupe32




PostPosted: 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)?
Insectoid




PostPosted: 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'.
Crupe32




PostPosted: 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?
Insectoid




PostPosted: 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)?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: