I am trying to make a maze game, and am having trouble with stopping my character going through the walls. I don't want it to bounce off.
Offline
Put this script somewhere in there
[blocks]<if><touching[ wall
<broadcast[ stop
<end>[/blocks]
AND
[blocks]
<when I receive[ stop
<change y by( 0
<change x by( 0[/blocks]
See if that works
Offline
Not really... The walls are part of the background. whatever I try the sprite keeps either walking through the walls or getting stuck *sigh*
Offline
Put this script into your sprite that goes through the maze:
When Flag Clicked Forever if <touching color [color of maze walls]> If <(direction) = (90)> change x by (negative something) ____ If <(direction) = (-90)> change x by (positive something) ____ If <(direction) = (0)> change y by (negative something) ____ If <(direction) = (180)> change y by (positive something)
This should help if you don't have any curved or diagonal walls, and your sprite that goes through the maze points in different directions as it moves. You may have to edit the scripting a little bit, but, it should work out.
EDIT:
Here is the script in high quality
Last edited by coka (2010-07-09 12:33:47)
Offline
It really depends what way the character moves in the first place.
Can you show us the scripts for your thing that moves through the maze?
Offline
There's also a bit of the wall that the character keeps walking through.
Last edited by melikecheese (2010-07-09 12:40:58)
Offline
coka wrote:
melikecheese wrote:
There's also a bit of the wall that the character keeps walking through.
So you are saying that my suggestion works, but it still walks through a little bit?
Yes.
Offline
melikecheese wrote:
coka wrote:
So you are saying that my suggestion works, but it still walks through a little bit?
Yes.
Okay, what did you plug in for the x and y values? It may be to much or too little. You may want to experiment with different values.
Offline
It still goes weird. That's the same problem I've had with all the other things I've tried. I could sort it out if I knew what the problem was and why it is doing this!!!
Offline
melikecheese wrote:
It still goes weird. That's the same problem I've had with all the other things I've tried. I could sort it out if I knew what the problem was and why it is doing this!!!
Could you post it online so I could take a look at it? Sometimes it is easier help when the project is in front of me. Thanks
Offline
http://scratch.mit.edu/projects/melikecheese/1181407
I didn't want it on the front page. It's not finished. The enemy disapears because I wanted to test something.
Last edited by melikecheese (2010-07-09 13:08:49)
Offline
Oh dear... I don't want you to spend all your time helping me on my project. Your making me feel kinda guilty.
Last edited by melikecheese (2010-07-09 13:18:41)
Offline
Okay I found a solution. It may make your project just a tad choppy, but it will work. Right now, your character moves with these scripts:
Change all of those scripts to this format:
This format makes the rotation of your character more visible, to remove that, click on this button which is above the scripting area:
No need to feel guilty, this is what Scratch is all about. I've had others help me on projects countless times!
Last edited by coka (2010-07-09 13:21:46)
Offline
NOOOOOOOOOOOOOO. I just accidentally got rid of a load of stuff so I closed it without saving... Not a wise move. I will have to do a load of stuff again.
EDIT: Sorted. Thank you for helping me. I still feel guilty but... oh well
Thanks again for helping
Last edited by melikecheese (2010-07-09 13:36:47)
Offline
Still... that's however many minutes of your life gone. Minutes that you'll never get back.
Offline
That will stop your character going through walls, I am not really sure why coka talled you to change your walking script, that just makes it jumpier.
Offline