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

#1 2011-10-06 11:08:01

bigpboy
New Scratcher
Registered: 2011-10-06
Posts: 2

Walls

I'm making a simple platformer where you play as a smiley face, jump onto a platform, then a moving cloud, which you use to get a key, which causes a cage covering the goal to raise. My problem is that you can pass through the cage. How do I make it so that my smiley does not pass through the cage. The cage is nothing advanced, something like this:

----------
| | | | |
----------
| | | | |
----------
| | | | |
----------
| | | | |
----------

Offline

 

#2 2011-10-06 12:34:51

TinkerZone
New Scratcher
Registered: 2011-08-25
Posts: 10

Re: Walls

Make some sprites for each boundary. A simple black line the length of a boundary would work.  Code these boundaries to position them on the cage edges and hide them.  With these in place you can have your character check for them, not pass them, etc.

Offline

 

#3 2011-10-06 16:15:29

Daroach1
Scratcher
Registered: 2011-09-11
Posts: 1000+

Re: Walls

TinkerZone wrote:

Make some sprites for each boundary. A simple black line the length of a boundary would work.  Code these boundaries to position them on the cage edges and hide them.  With these in place you can have your character check for them, not pass them, etc.

try making  the sprite under the cage black and do, if touching color black if direction=right change x by -5 if direction=left change x by 5. that works really well but change the first if, (if touching color black) to forever if. Hope that helps!  big_smile  I will check it out when its done!


http://i47.tinypic.com/v83mhl.png

Offline

 

#4 2011-10-11 10:53:16

bigpboy
New Scratcher
Registered: 2011-10-06
Posts: 2

Re: Walls

Thanks for the help. Instead of touching a color, I said touching a sprite, since I have a flagpole that's black. The game (very small; shouldn't need to be downloaded) will be up soon after this is.

Offline

 

#5 2011-10-12 10:16:07

TinkerZone
New Scratcher
Registered: 2011-08-25
Posts: 10

Re: Walls

bigpboy wrote:

Thanks for the help. Instead of touching a color, I said touching a sprite, since I have a flagpole that's black. The game (very small; shouldn't need to be downloaded) will be up soon after this is.

I have found using object interactions is better than sensing colors.  When you get this done, post a link please.

Good luck.

Offline

 

Board footer