double button
Author |
Message |
TrAnCeIn4LiFe
![](http://www.tranceaddict.com/forum/avatar.php?userid=21291&dateline=1083768219)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sat Jun 05, 2004 10:09 am Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Jun 05, 2004 2:01 pm Post subject: (No 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. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: 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") |
|
|
|
|
![](images/spacer.gif) |
omni
![](http://www.ffonline.com/1_ff8gfx/index-pic1.jpg)
|
Posted: Sat Jun 05, 2004 6:24 pm Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
TrAnCeIn4LiFe
![](http://www.tranceaddict.com/forum/avatar.php?userid=21291&dateline=1083768219)
|
Posted: Sat Jun 05, 2004 8:35 pm Post subject: (No subject) |
|
|
ahem this is what my code looks like
code: | % input keys to move plane around
loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
for x : 1 .. 1
xx (x) := x
yt := 4
end for
elsif chars (KEY_RIGHT_ARROW) then
for x : 1 .. 1
xx (x) := 2
xr := 4
end for
elsif chars (KEY_DOWN_ARROW) then
for x : 1 .. 1
xx (x) := x
yb := yb - 4
end for
elsif chars (KEY_LEFT_ARROW) then
for x : 1 .. 1
xx (x) := x + 2
xl := xl - 4
end for
end if
if chars ('x') then
if xx (1) > 0 then
for bullet : 1 .. maxy
for x : 1 .. 1
bxr := bxr + xl + xr
byt := byt + yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
Pic.Draw (missle, bxr + 25, byt + bullet, picMerge)
View.Update
Pic.Draw (missle, bxr + 0, byt + bullet, picMerge)
View.Update
Pic.Draw (missle, bxr + 50, byt + bullet, picMerge)
bars
end for
end for
end if
elsif chars ('z') then
if xx (1) > 0 then
for bullet : 1 .. maxy
for x : 1 .. 1
bxr := bxr + xl + xr
byt := byt + yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
Pic.Draw (missle, bxr + 25, byt + bullet, picMerge)
bars
end for
end for
end if
end if
if xx (1) > 0 then % move the airplane
for x : 1 .. 1
bxr := bxr + xl + xr
byt := byt + yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
bars
end for
View.Update
end if
|
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... |
|
|
|
|
![](images/spacer.gif) |
omni
![](http://www.ffonline.com/1_ff8gfx/index-pic1.jpg)
|
Posted: Sat Jun 05, 2004 9:30 pm Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
|
|