This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-29 12:10:44

Mileaz
Scratcher
Registered: 2012-11-30
Posts: 31

Changing scroll x position

Hi there.
I'm having some trouble with getting my sprite to get teleported back to a checkpoint when it dies without ending up jammed into the side of the screen?
Is there a way I can make my sprite stay in the middle of the screen after changing the scroll x position of it?


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Stalker%21/mca.png

Offline

 

#2 2013-01-29 12:49:41

dechan
Scratcher
Registered: 2012-12-20
Posts: 69

Re: Changing scroll x position

The magic of ScrollX is that you use it to move all of the other sprites.
If you use it to modify the sprite the player controls there's going to be a problem.
Think of the 480x360 screen as a viewport and that by modifying the x/y position of the other sprites using ScrollX and ScrollY you generate a movement of the environment while the player's sprite stays perfectly still.

Last edited by dechan (2013-01-29 12:50:53)

Offline

 

#3 2013-01-29 14:40:55

Mileaz
Scratcher
Registered: 2012-11-30
Posts: 31

Re: Changing scroll x position

Hmm, so is there a way I can move the background so my sprite is where I want it?


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Stalker%21/mca.png

Offline

 

#4 2013-01-29 16:03:05

dechan
Scratcher
Registered: 2012-12-20
Posts: 69

Re: Changing scroll x position

I believe our esteemed colleague ErnieParke has answered these questions before  big_smile   
Check this thread

What's important to remember is that backgrounds are really sprites so moving them vs. moving an enemy is just an issue of scale. The mechanics of using ScrollX/ScrollY are the same.

Last edited by dechan (2013-01-29 16:06:29)

Offline

 

#5 2013-01-30 13:18:12

Mileaz
Scratcher
Registered: 2012-11-30
Posts: 31

Re: Changing scroll x position

Thank you very much, I managed to figure it out and it was much simpler than I imagined. Thanks again.  smile


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Stalker%21/mca.png

Offline

 

Board footer