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

#1 2010-12-13 06:39:57

Tokeshi
New Scratcher
Registered: 2010-12-07
Posts: 5

Ground (Question)

Hello all,

I'm looking for tutorials how to do: sprite walking on other some sprites...


Question 2 is: What is the code for sprite to scrolling... Example: Cat runing on 2 sprites with x=480 each but he can't run on other sprite because no code...

Offline

 

#2 2010-12-13 15:14:49

NeoAtVic
Scratcher
Registered: 2010-10-04
Posts: 67

Re: Ground (Question)

When you say sprite walking on other sprites do you mean having a "background" sprite and a character sprite and having the character running across the background?

Basic Tutorial on how to do it
A good example

When adding in a character you simply don't move the characters x position, just simply change the "scroll" variable to make it appear that the character is moving along the background  smile

Hope that helps in some way  smile


http://farm3.static.flickr.com/2796/4519763712_5fab3a6935_o.png

Offline

 

#3 2010-12-13 17:04:42

Tokeshi
New Scratcher
Registered: 2010-12-07
Posts: 5

Re: Ground (Question)

Thank you very much...  smile

Offline

 

#4 2010-12-18 09:57:29

Tokeshi
New Scratcher
Registered: 2010-12-07
Posts: 5

Re: Ground (Question)

But i need tutorial to walk on sprite too....

Offline

 

#5 2010-12-18 14:32:23

Tokeshi
New Scratcher
Registered: 2010-12-07
Posts: 5

Re: Ground (Question)

So... no members here who know that?

Offline

 

#6 2010-12-18 15:00:19

XplodingEggs
Scratcher
Registered: 2009-12-09
Posts: 100+

Re: Ground (Question)

For walking on a sprite, you should have a sensor color at the bottom of the sprite that is doing the walking. Then have a script that says

The script is like this:
If color {Sensor color} is touching color {terrain color}
            Set {"A variable you will use for velocity Y, call it what you like"} to 0.15
Change {VelocityY} by -0.15
Change {Y} by {VelocityY}
If {key Right arrow} is pressed
            Change {X} by {"whatever you want your speed to be, Positive"}
If {Key left arrow} is pressed
             Change {X} by {"Whatever you want your speed to be, negative"}

The script will look something like that, there are also ways to add velocity to going left and right, and that makes it go faster the longer you push the button, and slow down when you stop pushing the button. Hope this helps!  big_smile

Last edited by XplodingEggs (2010-12-18 15:00:43)


http://i54.tinypic.com/102kqr7.jpg

Offline

 

Board footer