Help With Shooting
Author |
Message |
Guy
|
Posted: Wed May 18, 2005 11:11 am Post subject: Help With Shooting |
|
|
I can only shoot 1 bullet...... then i can shoot another only when the bullet i shot before comes off the screen...I need to know how to shoot bullets continuously.
var x, x2, y, y2 : int := 200
var shot : boolean := false
var bulletx, bullety : int := 0
var input : array char of boolean
setscreen ("offscreenonly")
loop
colorback (black)
cls
drawfillbox (50, 110, 40, 280, white)
drawfillbox (590, 110, 600, 280, white)
drawfillbox (490, 0, 500, 25, white)
drawfillbox (490, 375, 500, maxy, white)
drawfillbox (125, 375, 135, maxy, white)
drawfillbox (125, 0, 135, 25, white)
drawfilloval (320, 190, 50, 50, white)
drawfilloval (450, 200, 6, 6, brightblue)
drawfilloval (x, y, 6, 6, brightred)
Input.KeyDown (input)
if input (KEY_UP_ARROW) then
y := y + 5
elsif input (KEY_DOWN_ARROW) then
y := y - 5
elsif input (KEY_LEFT_ARROW) then
x := x - 5
elsif input (KEY_RIGHT_ARROW) then
x := x + 5
elsif input (KEY_SHIFT) and shot = false then
shot := true
bulletx := x + 5
bullety := y
end if
if bulletx < maxx and shot then
bulletx += 5
drawline (bulletx, bullety, bulletx + 10, bullety, white)
elsif bulletx >= maxx then
shot := false
end if
View.Update
delay (10)
end loop
it will be great id someone could help me |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Token
|
Posted: Wed May 18, 2005 11:38 am Post subject: (No subject) |
|
|
i think processes would be the answer here, although they are kinda crappy and they slow down ur program its probibly the way to go |
|
|
|
|
|
jamonathin
|
Posted: Wed May 18, 2005 11:40 am Post subject: (No subject) |
|
|
First of all, use code tags. code: | [code]Put your code here.[/code] |
Ok, now there are several of these types of programs here. Read through this one that's being worked on now, and learn from it.
Here's a hint, if you want to shoot more than 1 bullet, it's easiest to put it into an array.
http://www.compsci.ca/v2/viewtopic.php?t=8789
Any please quit posting about this topic. You've made about 3 already, and there's no real difference in them.
EDIT - Token: Most definately not, never use process' for something like that, there's always a way around doing more than one thing at the same time. |
|
|
|
|
|
|
|