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

#1 2012-04-13 14:47:02

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Walls

Please help, it sounds basic but I want my sprite to not be able to go through walls on the background. The walls are black and I don't want the sprite to die or anything, I just want the sprite to be able to move in another direction as normal.

I have a way involving changing direction and moving 5 steps in the other way but the sprite can still penetrate the walls moving diagonally.

Thanks  big_smile


http://i46.tinypic.com/ao03lk.png

Offline

 

#2 2012-04-13 16:22:46

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Walls

when gf clicked
forever
if<key [up arrow v] pressed?>
change y by (4)
if<touching [#000000]?>
change y by (-4)
end
end
if<key [down arrow v] pressed?>
change y by (-4)
if<touching [#000000]?>
change y by (4)
end
end
if<key [right arrow v] pressed?>
change x by (4)
if<touching [#000000]?>
change x by (-4)
end
end
if<key [left arrow v] pressed?>
change x by (-4)
if<touching [#000000]?>
change x by (4)
end
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-04-13 16:25:47

ftf841
Scratcher
Registered: 2012-02-19
Posts: 1000+

Re: Walls

when gf clicked
forever
if <touching [wall v] ?>
change x by [-4]

Last edited by ftf841 (2012-04-13 16:26:28)


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Hi+there./mca.png
http://mag.racked.eu/mcimage/i354/Achievement++get%21/CAKE%21%21%21%21%21/mca.png

Offline

 

#4 2012-04-13 23:39:32

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: Walls

ftf841 wrote:

when gf clicked
forever
if <touching [wall v] ?>
change x by [-4]

There is a little problem with that.
The wall is part of the background and not a sprite.

That script could work if the walls were turned into a sprite.


-SOScratch
Scratch On!

Offline

 

#5 2012-04-14 14:17:21

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Walls

You need to make the wall thincker. On of my "Archery" games (see below), there is an occasional glitch that makes it go through the walls. I've got many suggestions saying that i need to make the wall thicker.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#6 2012-04-14 14:31:28

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Walls

mythbusteranimator wrote:

You need to make the wall thincker. On of my "Archery" games (see below), there is an occasional glitch that makes it go through the walls. I've got many suggestions saying that i need to make the wall thicker.

Actually you can either make the wall thicker or the arrow longer, or simply decrease the speed of the arrow.  I believe the glitch you're speaking of is caused by the arrow moving faster and it is long, so it skips over some pixels when it moves.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer