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

#1 2010-07-20 10:28:58

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

how do i make it so my character can't walk on black

I'm making a Pokemon game and I want to make it so my character stops walking when it comes in contact with objects like the TV, or a table, or a tree, or the wall. I can't figure it out. I tried, but the second my character touched the color black she couldn't move at all in any direction.

Offline

 

#2 2010-07-20 11:23:46

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: how do i make it so my character can't walk on black

What script are you using at the moment?
Would this be helpful
http://i30.tinypic.com/16joe48.jpg

Last edited by melikecheese (2010-07-20 11:25:42)


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#3 2010-07-20 13:15:36

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do i make it so my character can't walk on black

i'm trying to use an "if" block, as in if my person is touching the color black, etc. But it won't work...

Offline

 

#4 2010-07-20 13:22:49

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: how do i make it so my character can't walk on black

gamer_6 wrote:

i'm trying to use an "if" block, as in if my person is touching the color black, etc. But it won't work...

try this:

[if < <not<touching color [black]> > and <key right arrow pressed> >]
[change x by (10)]
[end if]


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#5 2010-07-20 13:29:02

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do i make it so my character can't walk on black

i also tried the thing that you suggested, and it didn't work... I'm trying to make my character move in all directions (up, down, left, right) and if i touch black i want to stop moving. for example, if my sprite was walking down, and she touched black, she wouldn't be able to move down anymore but still left, right, and up

Offline

 

#6 2010-07-20 13:37:12

lilacfuzz101
Scratcher
Registered: 2010-05-22
Posts: 1000+

Re: how do i make it so my character can't walk on black

maybe if touching balck move negative amount of spaces?


http://25.media.tumblr.com/tumblr_lzqaicLrY01r5wdo7o1_500.gif

Offline

 

#7 2010-07-20 13:47:33

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do i make it so my character can't walk on black

scratchreallyrocks, yours works except that if i have it on all of my sprite's directions (up, down, left, and right) i can't move at all if i touch black. I want to be able to move away from the black if i touch it.

Offline

 

#8 2010-07-20 14:00:26

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: how do i make it so my character can't walk on black

gamer_6 wrote:

scratchreallyrocks, yours works except that if i have it on all of my sprite's directions (up, down, left, and right) i can't move at all if i touch black. I want to be able to move away from the black if i touch it.

Okay, then use this: http://scratch.mit.edu/projects/Scratch … KS/1202655


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#9 2010-07-20 17:10:34

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: how do i make it so my character can't walk on black

You could also use the color sensing scripts from Clash or Clash 2!

This is pretty much how it works:

http://i25.tinypic.com/e0hfno.png The Sensor's Scripts:

http://i28.tinypic.com/2ui7io3.gif

http://i30.tinypic.com/29goawx.jpgPlayer1's Scripts:

http://i32.tinypic.com/359h8uu.jpg


PS: This tests for each side instead of the entire sprite. Hope this helps!  wink


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

Board footer