Sprite remaining in middle, screen moving
Author |
Message |
Crupe32
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Crupe32
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Crupe32
|
Posted: 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)? |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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'. |
|
|
|
|
![](images/spacer.gif) |
Crupe32
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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)? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|