Alice Community  

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

Reply
 
Thread Tools Display Modes
how to make a barrier
Old
davise
Guest
 
Status:
Posts: n/a
Default how to make a barrier - 11-03-2009, 09:45 AM

I am trying to make a replication of the Pac-Man game, and I was wondering if there is a way to make a barrier in the course that your "pac-man" can not go through...

i.e.-the arrow keys move the "pac-man" and you have to collect all the "dots" but i need it to where the "pac-man" can not go through the wall so that they cant be caught by the "bad pac-man"....

If someone could explain to me how to do this or possibly make a world for example code that would be great.


Thanks,
Evan
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 11-03-2009, 10:00 PM

Well you could make a series of rectangles to form a maze. Then you create a group named walls with all those. Then write your code like this:

loop infinity times
for all together
if pacman is within 1 meter of walls
pacman move backward 1 meter
   
Reply With Quote
Old
davise
Guest
 
Status:
Posts: n/a
Default 11-05-2009, 09:10 AM

Thanks I will try that after I get the maze set up(which will take a while)but i'll tell you how it all worked out, and I might post the world on here after we finish it(but the might be quite a while too)
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.