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

#1 2010-07-09 11:47:14

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

Maze game

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.


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

Offline

 

#2 2010-07-09 12:02:08

Aidan
Scratcher
Registered: 2007-06-15
Posts: 1000+

Re: Maze game

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  smile

Offline

 

#3 2010-07-09 12:15:16

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

Re: Maze game

Not really... The walls are part of the background. whatever I try the sprite keeps either walking through the walls or getting stuck *sigh*


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

Offline

 

#4 2010-07-09 12:26:28

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

Put this script into your sprite that goes through the maze:

Code:

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.  wink

EDIT:
Here is the script in high quality
http://imgur.com/g6JZA.gif

Last edited by coka (2010-07-09 12:33:47)


http://i42.tinypic.com/2rot8c2.png

Offline

 

#5 2010-07-09 12:31:50

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Maze game

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

 

#6 2010-07-09 12:40:24

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

Re: Maze game

http://i31.tinypic.com/30ldxnd.jpg
There's also a bit of the wall that the character keeps walking through.

Last edited by melikecheese (2010-07-09 12:40:58)


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

Offline

 

#7 2010-07-09 12:42:22

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

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?


http://i42.tinypic.com/2rot8c2.png

Offline

 

#8 2010-07-09 12:45:01

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

Re: Maze game

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.


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

Offline

 

#9 2010-07-09 12:48:11

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

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.


http://i42.tinypic.com/2rot8c2.png

Offline

 

#10 2010-07-09 12:51:40

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

Re: Maze game

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!!!


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

Offline

 

#11 2010-07-09 12:53:22

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

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.  wink  Thanks


http://i42.tinypic.com/2rot8c2.png

Offline

 

#12 2010-07-09 13:03:20

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

Thanks for posting the project, I'll take a look at it!  smile


http://i42.tinypic.com/2rot8c2.png

Offline

 

#13 2010-07-09 13:05:02

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

Re: Maze game

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)


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

Offline

 

#14 2010-07-09 13:11:44

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

It's a great project, and nice idea.  wink  The reason it goes through the wall is because two or more arrow keys are pressed at a time. I just have to find a way to make it so it won't react like that when two keys are pressed  big_smile


http://i42.tinypic.com/2rot8c2.png

Offline

 

#15 2010-07-09 13:17:47

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

Re: Maze game

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)


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

Offline

 

#16 2010-07-09 13:20:42

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

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:
http://imgur.com/WqtuS.gif
Change all of those scripts to this format:
http://imgur.com/Y8lXz.gif
This format makes the rotation of your character more visible, to remove that, click on this button which is above the scripting area:
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/No-Rotate_Button.gif

No need to feel guilty, this is what Scratch is all about. I've had others help me on projects countless times!  wink

Last edited by coka (2010-07-09 13:21:46)


http://i42.tinypic.com/2rot8c2.png

Offline

 

#17 2010-07-09 13:28:38

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

Re: Maze game

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)


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

Offline

 

#18 2010-07-09 13:57:42

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: Maze game

No problem  wink  No need to feel guilty though, it only took minutes to figure out.


http://i42.tinypic.com/2rot8c2.png

Offline

 

#19 2010-07-09 14:01:49

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

Re: Maze game

Still... that's however many minutes of your life gone. Minutes that you'll never get back.


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

Offline

 

#20 2010-07-10 14:01:55

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Maze game

http://i32.tinypic.com/2h38os6.jpg

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

 

Board footer