Computer Science Canada double button |
Author: | TrAnCeIn4LiFe [ Sat Jun 05, 2004 9:43 am ] |
Post subject: | double button |
is there a way to make two buttons work at once, because i have missles shooting out of my plane and when i shoot everything pauses until the missle hits.. is there a way to get ride of that? |
Author: | Paul [ Sat Jun 05, 2004 10:09 am ] |
Post subject: | |
Don't enclose your missile moving part in it's own loop, have it as a part of the other parts of the program (like plane moving) or have a process. |
Author: | Dan [ Sat Jun 05, 2004 2:01 pm ] |
Post subject: | |
Paul Bian wrote: Don't enclose your missile moving part in it's own loop, have it as a part of the other parts of the program (like plane moving) or have a process.
I whould not recomend process for this, probly best to make one main loop with deals with eveything. Process can be good but you have to understand how they work and turing has limited conortl over them. Since turing has no way to set proity of a process all you know is that the code may run at some time. So baliky unless you got a dual CPU system a process will run lines of code in it at basicly random times durning the excution of your progame. If it dose not mater when they run then it could be good to use them but it gives you less conortl over things. |
Author: | Cervantes [ Sat Jun 05, 2004 5:09 pm ] |
Post subject: | Re: double button |
TrAnCeIn4LiFe wrote: is there a way to make two buttons work at once, because i have missles shooting out of my plane and when i shoot everything pauses until the missle hits.. is there a way to get ride of that?
are you using getch? if so, use Input.KeyDown. are you talking about mouse buttons or keyboard buttons? if mouse buttons, then use Mouse.ButtonChoose("multibutton") |
Author: | omni [ Sat Jun 05, 2004 6:24 pm ] |
Post subject: | |
i dont think those are the buttons hes talking about Cervantes. I had a similiar problem with my shooting game. Whenever the user pressed a button to shoot, I would call a procedure to shoot the bullet. THAT was my mistake. As the others said, make your main game loop handle the bullet increasing. I think this is what TrAnCeIn4LiFe code looks like: proc shoot loop %increase bullet exit when bullethitwall=true end loop end shoot loop if key(shoot) then shoot end if end loop Well at least thats what my code looked like before. |
Author: | TrAnCeIn4LiFe [ Sat Jun 05, 2004 8:35 pm ] | ||
Post subject: | |||
ahem this is what my code looks like
adn the problem is i have liek wind factor in my game so it pushes you to the sides... ehe makes it more challenging but the main problem is when i shoot the plain gets stuck with the shot like the screen freezes in the spot until the shot gets to the end of y... |
Author: | omni [ Sat Jun 05, 2004 9:30 pm ] |
Post subject: | |
still is the same thing, you put the bullet increasing and drawing in a separate loop. So that means that the program has to finish with that loop before going on with the main game loop. If you move it somehow into the main game loop, then you wouldn't have the problem. |