My First Program

This is my first program, and I got as far as I could before I started having problems. I hope someone can help me make this into a simple shooter game!! Thanks!! :slight_smile:

-- Shooter
function draw()
    background(52, 52, 52, 255)
end
    b=0
    t = touch
    shoot = false

function touched(touch)

    if touch.state == BEGAN then
        shoot = true 
        b=0+1
    end
    if shoot == true then
        ellipse( CurrentTouch.x, CurrentTouch.y, 50 )
            if b>0 then
                speech.say("9 bullets remaining.")
            end   
end
end
    end

I also don’t know how to make those little code boxes. :confused:

Put ~~~ at the top and bottom of the code block

Ok, thanks!! :slight_smile:

Just the three tildes, not the back-ticks

Yes, I only have tildes. :slight_smile:

@ProCoderJace You had spaces in front of your ending Tildes. I removed the spaces on your code above.

Oh, okay, thanks!! :slight_smile:

@ProCoderJace Are you trying for something like this. Tap screen to shoot.

function setup()  
    b=9 
end

function draw()
    background(52, 52, 52, 255)
    fill(255)
    if shoot then
        ellipse(bx,by,10)
        by=by+10
    end
end

function touched(touch)
    if touch.state == BEGAN then
        shoot=true
        bx=touch.x
        by=touch.y
        b=b-1
        if b>1 then
            speech.say(b.." bullets remaining.")
        elseif b==1 then
            speech.say("one bullet remaining")
        else
            speech.say("you are out of bullets")
            shoot=false
        end
    end   
end

Yes, thanks a lot!! :slight_smile:

(One of my problems was tweening, I have no idea how to use it :))

There are plenty examples for tweens. Just do a forum search.