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

#1 2012-08-25 18:14:07

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

edge help

how do i make a character sense only a certain wall?

Offline

 

#2 2012-08-25 18:19:40

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: edge help

If it's a certain edge, please specify which edge of the screen (top,left,right,bottom), if it's a wall you made in the game, you can use color sensing, or if it's a certain sprite that's the wall, use the touching block. Like this:

if<key [up v] pressed?>
if <not<touching color[#00FF00]?>>
change y by (10)
end
end
if <key [down v] pressed?>
if <not <touching [sprite1 v]?>>
change y by (-10)
end
end

Offline

 

#3 2012-08-25 18:35:37

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: edge help

Here's what I do! So, I make a sprite that is a line, that I can put on the edge that I want to be sensed. Then I set that sprite (the line) so it's ghost affect = 99% (so it isn't visible, but it's still there) like this:

when gf clicked
set [ghost v] effect to (99)
Then the script I use for the sprite (sprites) who need to be able to sense this edge I do this:

when gf clicked
forever
   if <touching color [ ]?>
      (do what ever you want your sprite to do when touching this edge)
   end
end
you can also do this for part of that last script

forever
   if <touching [sprite on the special edge]?>
      (do what must be done!)
   end
end
So, that's what I do, hope it all made sense  wink

Last edited by tree-hugger (2012-08-25 18:39:28)


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#4 2012-08-25 18:49:02

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: edge help

thanks guys

Offline

 

Board footer