Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Help with arrays
Author Message
recneps

Posted: Sat Dec 27, 2003 8:43 pm   Post subject: Help with arrays

im making a little jump/shoot game like the old duke nukems, etc and ive got the jumpin and shooting down, but i cant seem to get an array so that you can shoot more than one bullet. Can anyone help me?
heres what i got.
 code: var bulletx, bullety, x, y : int bulletx := 0 bullety := 0 x := 25 y := 50 var keys : array char of boolean var right : char := chr (205) var left : char := chr (203) var space : char := chr (32) var enter : char := chr (10) var esc : char := chr (26) var bulletmove, movex, movey : int movex := 0 movey := 0 bulletmove := 0 var show := false put "Use arrow keys to move, Space to jump, and enter to shoot." delay(1000) cls setscreen ("offscreenonly") loop     if show = true then         drawfilloval (bulletx, bullety, 2, 2, 7)     end if     if bulletx > maxx then         show := false     end if     drawoval (x, y, 10, 10, 7)     Input.KeyDown (keys)     if keys (right) then         if y > 50 then             movex := 0             movex := movex + 2         else             movex := 0             x := x + 5         end if     elsif keys (left) then         if y > 50 then             movex := 0             movex := movex - 2         else             movex := 0             x := x - 5         end if     elsif keys (space) then         if y = 50 then             movey := 0             movey := movey + 5         end if     elsif keys (enter) then         bulletx := x + 5         bullety := y         show := true     end if     if y > 200 then         movey := -movey     elsif y < 50 then         y := 50         movey := 0         movex := 0     end if     if x < 0 then         x := 0     elsif x > maxx then         x := maxx     end if     y := movey + y     x := movex + x     delay (25)     bulletx := bulletx + 5     View.Update     cls     exit when keys (esc) end loop