
-----------------------------------
GlobeTrotter
Tue Oct 26, 2004 8:33 pm

How do I stop my game from pausing when I shoot?
-----------------------------------
In this code, when I press enter, it times how long you hold the key and shoots the bullet with speed relative to that time.  The problem is, say I am holding up and I hold enter, I stop moving.  How can I stop the game from pausing, but accomplish the same task?


var gmaxx, gmaxy : int := 1000
setscreen ("graphics:500,500;offscreenonly")
var timer : int := 0
var x, y, dir, speed : real
var chars : array char of boolean
var bullets : int := 0
var size := 30
var bulletx, bullety, bulletdir, bulletvz, bulletz : flexible array 1 .. bullets of real
var explosions : int := 0
var explodex, explodey, explodetime : flexible array 1 .. explosions of real
const bulletdelay := 20
var temp := bulletdelay
var temp1 := 0
var hit, beep : boolean := false
var checkx, checky : real
x := maxx div 2
y := maxy div 2
var grav : real := 0.1
dir := 0
speed := 1

procedure gdrawline (x1 : int, y1 : int, x2 : int, y2 : int, col : int)
    drawline (round (maxx - x - (maxx div 2)) + x1, round (maxy - y - (maxy div 2)) + y1, round (maxx - x - (maxx div 2)) + x2, round (maxy - y - (maxy div 2)) + y2, col)
end gdrawline
procedure gdrawfilloval (x1 : int, y1 : int, xr : int, yr : int, col : int)
    drawfilloval (round (maxx - x - (maxx div 2)) + x1, round (maxy - y - (maxy div 2)) + y1, xr, yr, col)
end gdrawfilloval
procedure gdrawfill (x1 : int, y1 : int, col1 : int, col2 : int)
    drawfill (round (maxx - x - (maxx div 2)) + x1, round (maxy - y - (maxy div 2)) + y1, col1, col2)
end gdrawfill
procedure gdrawbox (x1 : int, y1 : int, x2 : int, y2 : int, col : int)
    drawbox (round (maxx - x - (maxx div 2)) + x1, round (maxy - y - (maxy div 2)) + y1, round (maxx - x - (maxx div 2)) + x2, round (maxy - y - (maxy div 2)) + y2, col)
end gdrawbox
procedure gdrawfillbox (x1 : int, y1 : int, x2 : int, y2 : int, col : int)
    drawfillbox (round (maxx - x - (maxx div 2)) + x1, round (maxy - y - (maxy div 2)) + y1, round (maxx - x - (maxx div 2)) + x2, round (maxy - y - (maxy div 2)) + y2, col)
end gdrawfillbox



loop
    timer += 1
    cls
    %delay (1)
    Input.KeyDown (chars)
    if chars (KEY_LEFT_ARROW) then
        dir += 1
    elsif chars (KEY_RIGHT_ARROW) then
        dir -= 1
    end if
    if chars (KEY_UP_ARROW) then
        checky := y + sind (dir) * speed
        checkx := x + cosd (dir) * speed
        if checky >= 10 + size and checky = 10 + size and checkx = 10 + size and checky = 10 + size and checkx = bulletdelay then
        loop
            Input.KeyDown (chars)
            if temp1  50 then
        gdrawfilloval (round (x - cosd (dir) * (size / 1.5)), round (y - sind (dir) * (size / 1.5)), size div 10, size div 10, 12)
    end if


    gdrawbox (10, 10, gmaxx - 10, gmaxy - 10, 7)

    for i : 1 .. bullets
        bulletx (i) += cosd (bulletdir (i)) * speed * 2
        bullety (i) += sind (bulletdir (i)) * speed * 2
        bulletz (i) += bulletvz (i)
        bulletvz (i) -= grav
        gdrawfilloval (bulletx (i) div 1, bullety (i) div 1, bulletz (i) div 50, bulletz (i) div 50, RGB.AddColor (1 - bulletz (i) / 300, 1 - bulletz (i) / 300, 1 -
            bulletz (i) / 300))
        if bulletx (i) > 20 and bulletx (i) < gmaxx - 20 and bullety (i) > 20 and bullety (i) < gmaxy - 20 and bulletz (i) >= 49 then
        else
            explosions += 1
            new explodex, explosions
            new explodey, explosions
            new explodetime, explosions

            explodex (explosions) := bulletx (i)
            explodey (explosions) := bullety (i)
            explodetime (explosions) := 30
            for k : i .. bullets - 1
                bulletx (k) := bulletx (k + 1)
                bullety (k) := bullety (k + 1)
                bulletdir (k) := bulletdir (k + 1)
                bulletz (k) := bulletz (k + 1)
                bulletvz (k) := bulletvz (k + 1)
            end for
            bullets -= 1
        end if
    end for
    for i : 1 .. explosions
        explodetime (i) -= 1
        gdrawfilloval (explodex (i) div 1, explodey (i) div 1, explodetime (i) div 4 + 7, explodetime (i) div 4 + 7, RGB.AddColor (explodetime (i) / 15, explodetime (i) / 45, 0))
        if explodetime (i) 