Computer Science Canada

ghost collision detection

Author:  gigaman [ Fri Jan 14, 2005 10:01 am ]
Post subject:  ghost collision detection

i need to know if anyone can give me an idea of how to fix this. the enemies should change to a random direction when they hit a wall. eventually this will be put into a pacman program.

Author:  w00t [ Fri Jan 14, 2005 10:19 am ]
Post subject: 

Hmm.. I ran this and nothing happened, ghosts where not drawn or anything, just the walls. Sorry i cant help

Author:  gigaman [ Fri Jan 14, 2005 10:13 pm ]
Post subject:  update

i don't know wat is wrong but you have to extract the file to be able to use it.

Author:  Cervantes [ Sat Jan 15, 2005 10:38 am ]
Post subject: 

You know, you can combine conditions using or and and. Right now, you've got a ton of if statements that have the same code inside them, just different conditions.
Take this example:
code:

if x = 1 then
  put x
elsif x = 2 then
  put x
end if

that can be shortened to:
code:

if x = 1 or x = 2 then
  put x
end if


As for your problem, try switching the placement of your procedures. That is, call the collision procedure before the draw procedure. I believe the problem is that the picture covers up the blue line, so when the collision proc is called, it doesn't detect the blue line.

Author:  gigaman [ Mon Jan 17, 2005 9:24 am ]
Post subject:  update

ok. i know what the problem is with it but i have no more ideas how to solve it. the problem is that when it reaches a side and move in that side's dorection again it is able to leave. example: if he starts at the top and goes down he cannot go daown again. however he can go right then go down again and leave. my idea was to have a sort of level system of whatdotcolours but that hasn't worked either. if soeone has an idea to solve this please help.


: