Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ghost collision detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gigaman




PostPosted: 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.


final assignment.zip
 Description:

Download
 Filename:  final assignment.zip
 Filesize:  66.86 KB
 Downloaded:  188 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
w00t




PostPosted: Fri Jan 14, 2005 10:19 am   Post subject: (No subject)

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




PostPosted: 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.


final assignment.zip
 Description:
may have to change the deelay in draw_enemy

Download
 Filename:  final assignment.zip
 Filesize:  66.87 KB
 Downloaded:  157 Time(s)

Cervantes




PostPosted: Sat Jan 15, 2005 10:38 am   Post subject: (No 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.
gigaman




PostPosted: 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.


final assignment.zip
 Description:
this is the one with the code that has "levels" of whatdotcolours

Download
 Filename:  final assignment.zip
 Filesize:  66.92 KB
 Downloaded:  162 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: