Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How do I make walls (in this case of a maze) unpassable.
Old
jamieirl
Guest
 
Status:
Posts: n/a
Default How do I make walls (in this case of a maze) unpassable. - 03-13-2010, 10:27 PM

Hi, I'm creating a maze for my introduction to programming class. Most of the program is written, however I'd like to make the walls unpassable (that a word?). It seems kind of silly that my character can just move through the walls. I've reread the chapter that the assignment is coming out of and I can't seem to find anything that suggest any ideas on how to make the walls of the maze act as a real wall would.

Thanks in advance for any help anyone can provide.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 04:21 AM

There's several different ways to go about doing this.

One is you could have a coordinate system where there's a list of blocked coordinates (to areas of where the walls are) and if the next coordinate is in that list, then the move commands will be ignored so the character can't pass it. Unfortunately, this method is limited in a few ways (diagonal paths will be in a choppy "staircase" pattern).

If you want a real-time collision detector, Zonedabone has made a nice one right here: http://www.alice.org/community/showthread.php?t=3994

There's a few more ways that this can be done, however these are just a couple.
   
Reply With Quote
Old
Jeremytroid
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 10:21 AM

Make an "If/Else" statement.
Then under "if" make

"'camera' is within threshhold of 'Maze'"
__________________________________________________ ________________________
"move backward 1 meter"
__________________________________________________ ________________________
Same thing for other objects. Make sure they are contolled by the arrow keys though.
   
Reply With Quote
Old
jamieirl
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 01:12 PM

Thanks guys, I'll see what I can do.
   
Reply With Quote
Old
jamieirl
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 04:17 PM

Quote:
Originally Posted by Jeremytroid View Post
Make an "If/Else" statement.
Then under "if" make

"'camera' is within threshhold of 'Maze'"
__________________________________________________ ________________________
"move backward 1 meter"
__________________________________________________ ________________________
Same thing for other objects. Make sure they are contolled by the arrow keys though.
I tried this one and it seems that the only part of the maze that is recognizable by the "camera is within threshhold of Maze" function is somewhere in the middle of the maze. I can't even find the part of the maze that the function recognizes. The only way I can get my 'robot' to move backwards is by raising the amount of meters that the camera is to be within the threshhold of the maze. Setting it to 100 meters will make my robot move backwards from anywhere within the maze (obviously, because my maze isn't even that large) but when set at a lower number (say 1 meter) I can walk through all of the walls until theoretically I find the absolute center of the maze (I'm assuming) which I haven't done yet.

I haven't tried Niteshifters suggestions yet because the assignment doesn't actually call for me to make the walls unpassable so I don't want to do anything too complicated (complicated for me, that is). I've only messed around with list on two assignments so far. I'm going to put this on pause for now but I may pick it up later. Thanks again to both of you.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 09:37 PM

Quote:
Originally Posted by jamieirl View Post
I haven't tried Niteshifters suggestions yet because the assignment doesn't actually call for me to make the walls unpassable so I don't want to do anything too complicated (complicated for me, that is). I've only messed around with list on two assignments so far. I'm going to put this on pause for now but I may pick it up later. Thanks again to both of you.
I guess I wouldn't recommend my first suggestion since it involves prior knowledge with list manipulation and vector programming and it might take a while to learn about it, but those parts of programming are my personal favorite and are pretty fun to play around with.
   
Reply With Quote
Old
Veryuhbull
Guest
 
Status:
Posts: n/a
Default 03-14-2010, 09:57 PM

On the top of the 5th page of the same topic i created a maze with collision you could use for refference. (that is a slow hard way to do collision although) Please do not just steal it.

http://alice.org/community/showthrea...8460#post18460
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.