Computer Science Canada Need help with Fighting game (Distance and computer movement |
Author: | Tony_200004 [ Thu Dec 04, 2003 10:19 pm ] |
Post subject: | Need help with Fighting game (Distance and computer movement |
Alright i fixed my movement earlier now its on to the computers movement.... currently he only moves when you move... also you can damage him and he can damage you from any distance... thanks for any help provided... also one quick last thing... loading music and sounds... thanks |
Author: | Andy [ Thu Dec 04, 2003 10:26 pm ] | ||||
Post subject: | |||||
as you know, the music has to be played as the game is running, so you need two things to simultaneously run at the same time. let me introduce you to something called a fork. fork is to activate a process and runs at the same time as your pogram to initialize a process
a process is exactly like a procedure, so you can have parameters and such. now, on to music
this code would play ur music once and the end it. if you want it to loop, just put the Music.PlayFile in a loop |
Author: | Tony_200004 [ Thu Dec 04, 2003 10:38 pm ] |
Post subject: | |
everytime i do the music file thing it says this "'process's may only be declared at the program or module level" ![]() |
Author: | Andy [ Thu Dec 04, 2003 10:40 pm ] |
Post subject: | |
you cant declare them in a procedure or a function or a loop or another process. |
Author: | AsianSensation [ Fri Dec 05, 2003 1:29 am ] |
Post subject: | |
to see if they damaged each other, you basiclly have to do collision detection. You check to see if the person's fist lands anywhere near the other person's body. |
Author: | Tony [ Fri Dec 05, 2003 9:59 am ] |
Post subject: | |
I suppose it depends on how you draw your fighters, but you can use oval collision detection, check for line intersection, etc to see if damage is behind delt. |
Author: | Andy [ Fri Dec 05, 2003 10:15 am ] |
Post subject: | |
if it is a concaved shape, i think i have a nice algorithms for calculating that... first you find the longest possible line you can draw from each coner to a side/coner within the shape, save those data, and when you use collision detection, check the distance from that point to each coner and if any value is greater than ur saved values, then its a hit... not sure if it works tho |