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

#1 2011-11-01 11:13:35

the12th
New Scratcher
Registered: 2011-11-01
Posts: 1

How do I make my sprite "land" on something?

I am making a game and I am trying to have my sprite jump and then land on a platform. However, the sprtie just falls through the platform.
I have a two questions:
1)Does the platform need to be a sprite, or part of the background?
2) How can I prevent the sprite from falling through (what code do I use)?

Thanks!

Offline

 

#2 2011-11-01 14:42:00

aldenhorbach
New Scratcher
Registered: 2011-09-22
Posts: 23

Re: How do I make my sprite "land" on something?

how bout something like this?
when flag clicked forever if key up arrow pressed repeat 20 change y by 10.
when flag clicked forever if not touching color(whatever) change y by -5
if touching color(whatever) change y by 5

Offline

 

#3 2011-11-01 14:51:12

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: How do I make my sprite "land" on something?

Try looking at this:
http://scratch.mit.edu/projects/RedRocker227/2118081


Why

Offline

 

#4 2011-11-01 14:54:15

Freakish
Scratcher
Registered: 2011-10-25
Posts: 1000+

Re: How do I make my sprite "land" on something?

you should look up a collision engine or something
and use that
otherwise realistic collision is hard to do


http://i.imgur.com/y3RBV.jpg

Offline

 

#5 2011-11-01 22:02:11

better
New Scratcher
Registered: 2011-08-18
Posts: 3

Re: How do I make my sprite "land" on something?

no, the platform must be a sprite :

Offline

 

#6 2011-11-02 11:47:43

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: How do I make my sprite "land" on something?

better wrote:

no, the platform must be a sprite :

No it doesn't. You can just put:
if touching (colour of platform)


Why

Offline

 

#7 2011-11-04 09:55:14

Jinck
Scratcher
Registered: 2009-07-18
Posts: 100+

Re: How do I make my sprite "land" on something?

The platform may be whatever you want (even a costume for your character sprite)

To make your sprite stand on a platform make a script similar to this

[blocks]http://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp:http://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp://scratch.mit.edu/forums/post.php?tid=79472#req_message1[/blocks]


Play Sins of A Solar Empire!!!!!!!! http://media.pcgamer.com/files/2012/03/Sins-of-A-Solar-Empire-Rebellion-5.jpg

Offline

 

#8 2011-11-04 09:57:22

Jinck
Scratcher
Registered: 2009-07-18
Posts: 100+

Re: How do I make my sprite "land" on something?

Jinck wrote:

The platform may be whatever you want (even a costume for your character sprite)

To make your sprite stand on a platform make a script similar to this

[blocks]http://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp:http://scratch.mit.edu/forums/post.php?tid=79472#req_messagehttp://scratch.mit.edu/forums/post.php?tid=79472#req_message1[/blocks]

That didn't come out right!


Play Sins of A Solar Empire!!!!!!!! http://media.pcgamer.com/files/2012/03/Sins-of-A-Solar-Empire-Rebellion-5.jpg

Offline

 

Board footer