Computer Science Canada

How do I change this bullet shooting into an array?

Author:  JPolasz [ Thu Jul 12, 2012 6:11 pm ]
Post subject:  How do I change this bullet shooting into an array?

What is it you are trying to achieve?
I want to make it so that the bullet only has 15 ammo, so it can only shoot 15 times then have to reload.


What is the problem you are having?
I don't know how to change it into an array and make it work.


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Very basic version of the bullet shooting.

Turing:


setscreen ("offscreenonly")

var char1_bulletx : int := 50
var char1_bullety : int := 50
var keys : array char of boolean
var char1_bulletalive : boolean := false

loop
    char1_bulletx := char1_bulletx + 1
    Input.KeyDown (keys)
    if keys (' ') and char1_bulletalive = false then
        char1_bulletalive := true
        char1_bulletx := 50
        char1_bullety := 50
    end if
    if char1_bulletalive = true then
        delay (1)
        cls
        drawfilloval (char1_bulletx, char1_bullety, 2, 2, black)
        View.Update
    end if
    if char1_bulletx >= maxx + 10 then
        char1_bulletalive := false
    end if
end loop



Please specify what version of Turing you are using
4.1.1a

Author:  Raknarg [ Thu Jul 12, 2012 6:31 pm ]
Post subject:  RE:How do I change this bullet shooting into an array?

I suppose the first question we ought to ask is do you know how to use arrays?


: