Ratchet And Clank like game

[…]


--Code here


--# Main
-- R&C

GAME_MENU = 0
GAME_PLAYING = 1
GAME_DEAD = 2
GAME_SHOP = 3
state = GAME_MENU
function setup()
    parameter.integer("x", 0, 700)
    parameter.integer("y", 0, 700)
    swordPurchase = false
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
if state == GAME_MENU then
    background(255, 255, 255)
    fontSize(50)
    fill(255, 147, 0, 255)
    text("Ratchet", 400, 700)
    fill(0, 0, 0, 255)
    text("&", 400, 650)
    fill(127, 127, 127, 255)
    text("Clank", 400, 600)
    
    fill(255, 0, 0, 255)
    fontSize(40)
    text("Double tap anywhere to play", 300, 200)
    end
    if state == GAME_PLAYING then
        background(255, 142, 0, 255)
        tint(255, 255, 255, 255)
        sprite("Platformer Art:Guy Standing", x, y)     
       
      fill(255, 0, 0, 255)
        text("double touch anywhere to shop", 400, 700)
        if swordPurchased == true then
            tint(255, 255, 255, 255)
            sprite("Small World:Sword", CurrentTouch.x, CurrentTouch.y)
            end
    end
    if state == GAME_SHOP then
        background(125, 125, 125, 255)
        fontSize(20)
        fill(255, 0, 0, 255)
        text("With good weapons comes good deals!", 400, 700)
        fill(255, 255, 255, 77)
        rect(200, 650, 400, 100)
        tint(255, 255, 255, 255)
        sprite("Small World:Sword", 100, 100)
        text("Sword: $:0", 100, 50)
    end
end
function touched(t)
    state = GAME_PLAYING
    if state == GAME_PLAYING and CurrentTouch.tapCount == 2 then
        state = GAME_SHOP
        end
        if state == GAME_SHOP and t.x > 99 then
            swordPurchased = true
            end
    end

If you’ll edit your comment to put ~~~ before and after your code, the formatting will be much nicer.

@code_maker I added the 3 ~ before and after your code so it formatted correctly.

Sorry! This version has been deleted! You can take the code from the current version though!(The bottom code)

–3.0 is here!

– R&C

–Created by: Apple Smell Games™

–Version 3.0

GAME_MENU = 0

GAME_PLAYING_FIRSTLVL = 1

GAME_DEAD = 2

GAME_SHOP = 3

en1 = vec2()

l = vec2()

b1 = vec2()

c = vec2()

en2 = vec2()

state = GAME_MENU

function setup()

parameter.integer("x", 0, 700, 188)


parameter.integer("y", 0, 700, 303)

parameter.watch(“enemy1Health”)

parameter.watch(“money”)

parameter.watch(“boss1Health”)

print(“You want to kill all the monsters before they hit the ground!”)

            money = {}


        --To see if the purchase has been made

        
swordPurchase = false


bladesPurchased = false


firePurchased = false


money = 0


--The health of everyone but the hero,that will come later


enemy2Health = 60


enemy1Health = 50


boss1Health = 300

end

– This function gets called once every frame

function draw()

en1.y = en1.y - 1

if state == GAME_MENU then

background(255, 255, 255)


fontSize(50)


fill(255, 147, 0, 255)


text("Ratchet", 400, 700)


fill(0, 0, 0, 255)


text("&", 400, 650)


fill(127, 127, 127, 255)


text("Clank", 400, 600)



fill(255, 0, 0, 255)


fontSize(40)


l.x = l.x + 1


text("?tap anywhere to play?", 300 + l.x, 200)


end


if state == GAME_PLAYING then

    
    en2.y = en2.y - 1

    
    background(255, 142, 0, 255)

  

    tint(255, 255, 255, 255)

    
    sprite("Platformer Art:Guy Standing", x, y)     

    
   sprite("Small World:Treasure", 100, 500)


fill(125, 255, 0, 255)


fontSize(30)


text("$: " ..money, 700, 400)


fill(255, 255, 255, 112)


rect(650, 375, 100, 50)


  fill(255, 0, 0, 255)


    text("double touch anywhere to shop", 400, 700)

    
    text("Triple tap anywhere to quit", 400, 650)

    
    if swordPurchased == true then

        
        tint(255, 255, 255, 255)

        
        sprite("Small World:Sword", CurrentTouch.x, CurrentTouch.y) 

        
        end

        
        if  bladesPurchased == true then

            
            
                sprite("Tyrian Remastered:Blades", CurrentTouch.x, CurrentTouch.y)

                
                end

                
                if firePurchased == true then

                    
                    sprite("Tyrian Remastered:Flame 1", CurrentTouch.x, CurrentTouch.y)

                    
                    end

                    
                
                if enemy1Health <1 then

                    
                    enemyHealth = 0

                    
            tint(0, 0, 0, 0)

            
           sprite("Platformer Art:Monster Standing", 400, 700 + en1.y)

        
       tint(255, 255, 255, 255)

    
    --DA BOSS!

    
    b1.x = b1.x - 1

    
   
    sprite("Tyrian Remastered:Blimp Boss", 400, 700 + b1.x)

    
    
        else

            
                tint(255, 255, 255, 255)

                
                sprite("Platformer Art:Monster Standing", 400, 700 + en1.y)

                
          end

        
                if boss1Health <1 then

                    
                    sprite("Tyrian Remastered:Blimp Boss Destroyed", 400, 700 + b1.x)

                    
                    end


                    
                    
        m1Coll = false

    
    
        if x <101 and x >99 or y <501 and y >499 then

            
            m1Coll = true

            
            
            end

            
        if m1Coll == true then

            
            money = money + 1

            
    end

    
end


if en1.y >99 then

    
    state = GAME_DEAD

    
    end

    
if state == GAME_SHOP then

    
    background(125, 125, 125, 255)

    
    fontSize(20)

    

    fill(255, 0, 0, 255)

    
    text("With good weapons comes good deals!", 400, 700)

    
    fill(255, 255, 255, 77)

    
    rect(200, 650, 400, 100)

    
    tint(255, 255, 255, 255)

    
    sprite("Small World:Sword", 100, 100)

    
    text("Sword: $:0", 100, 50)

    
    sprite("Tyrian Remastered:Blades", 200, 200)

    
    text("Blades: $:1", 200, 160)

    
    sprite("Tyrian Remastered:Flame 1", 300, 300)

text(“Fire: $: 10”, 300, 250)

    fill(52, 255, 0, 255)

    
    text("$: " ..money, 700, 400)

    
     if money > 0 and state == GAME_SHOP then

        
        bladesPurchased = true

        
        end

        
    end

    
    if state == GAME_DEAD then

        --unfinished...

        
        background(255, 0, 0, 255)

        
        fill(255, 255, 255, 255)

        
        fontSize(125)

        
        text("YOU DIED!", 400, 500)

        
    end

    
end

function touched(t)

state = GAME_PLAYING


if state == GAME_PLAYING and CurrentTouch.tapCount == 2 then

    
    state = GAME_SHOP

    
    end

    
    if state == GAME_SHOP and t.x > 99 or t.x < 104 then

        
        swordPurchased = true

        
        end

        
        if state == GAME_PLAYING and CurrentTouch.tapCount == 3 then

            
            state = GAME_MENU

            
    end

    
    if swordPurchased == true and t.x >en1.x then

        
        enemy1Health = enemy1Health -1

        
    end

    
    if bladesPurchased == true and t.x >en1.x then

        
        enemy1Health = enemy1Health - 5

        
    end

    
    if state == GAME_PLAYING and enemy1Health <1 and t.state == MOVING then

        
        boss1Health = boss1Health - 1

        
        end

        
        if state == GAME_SHOP and money <9 and t.x >299 and t.x <304 then

            
            firePurchased = true

            
    end

    
end

@code_maker A couple of suggestions. If you’re going to keep showing updated versions, you should probably delete your previous versions. And to keep your code smaller, you shouldn’t put blank lines between every line of code. Other than that your program is coming along fine.

Thanks for the idea! I will do that right now!