I NEED HELP (pls)

@Killer.Jo - could you outline , in words not code, how your project game works. What are the characters in it , how do they interact and how does the player win or lose. Do you want to use the built in graphics or do you have your own?

We can probably point you in the right direction then.

@Bri_G To start there is a button because you can click and if you click on it you have to decide between 3 boxes which you choose. The lower one is the right one. Then the same again. Now you come to the main menu. Unfortunately, I only coded one button on the main menu. Not the Iceland button. If you click on it (the button) you come to his farm (Iceland) and I want to do later that you can plant things there and earn coins with it. You should then farm the soil and so again and farm more coins for more things. If you need more information, just tell me

@Killer.Jo After reading what you wrote for @Bri_G, you have a lot of work to do. You need to get one thing working right before you add more things. The more things you add, the harder it is to figure out whatā€™s not working right.

@dave1707 Ok. But what should I do now? I think I find the problem nowā€¦

@Bri_G @dave1707 Yes!!! I did it!!! Here is the code if someone wants to see it:


-- Killer Jo

-- Killer Jo
viewer.mode = FULLSCREEN
viewer.retainedBacking = true

-- Definiere und initialisiere die Variablen
local GameStarts = false
local Start = false
local box01 = false
local Level02WIN = false
local level03 = false
local Apfelklik = false
local elapsedTime = 0
local clicks = 0
function setup()
    box = readImage(asset.builtin.Cargo_Bot.Crate_Yellow_2)
    Background = color(37)
    Startbutton = readImage(asset.builtin.UI.Blue_Button13)
    LVL2txt = "Es ist nicht 2"
    --Apfel = readImage(asset.documents.Apfel)
   -- Apfelklick = readImage(asset.documents.Apfel_klickt)
    --mainMenButton = readImage(asset.documents["Main_MenuĢˆ.png"])
    --mainTXT = "Menu"
    -- Startbutton = readImage(asset.builtin.Blocks.Blank_White)
    SkinEditor = readImage(asset.builtin.Blocks.Blank_White)
    Island = readImage(asset.builtin.Blocks.Blank_White)
    Ads = readImage(asset.builtin.Blocks.Blank_White)
    GameAds = readImage(asset.builtin.Blocks.Blank_White)
    Island = "Deine Insel"
    music(asset.documents["Lange StraƟe 20.m4a"])
    grass1= readImage(asset.builtin.Blocks.Dirt)
end


function draw()
    if not GameStarts then
        
        background(Background)
        sprite(Startbutton, 550, 500, 100, 100)
       -- sprite(mainMenButton, 200, 750, 70, 70)
        fill(255, 28, 0)
        font("ArialRoundedMTBold")
        text("Menu", 200, 750)
        sprite(Startbutton, 550, 300)
    end

    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 200-75 and CurrentTouch.x <= 200+75 and 
            CurrentTouch.y >= 750-19 and CurrentTouch.y <= 750+19 then   
            MAINMENU = true
        end 
    end
   if MAINMENU then
        
        end
    
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 500-75 and CurrentTouch.x <= 600+75 and 
            CurrentTouch.y >= 500-19 and CurrentTouch.y <= 500+19 then   
            Start=true
            
        end 
    end
    
    if Start then
        background(255)
        sprite(box, 800, 750)
        sprite(box, 250 , 500)
        sprite(box, 800, 150)
        
        if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 800-75 and CurrentTouch.x <= 800+75 and 
            CurrentTouch.y >= 150-19 and CurrentTouch.y <= 150+19 then   
            box01=true
            
        end 
        end
        
        if box01 then
            background(255)          
            fontSize(25)
            text(LVL2txt, 550, 700)
            sprite(box, 550, 500)
            sprite(box, 550, 300)
            sprite(box, 500, 150)
            fill(255, 237, 0)
            font("ArialRoundedMTBold")
            text("1", 550, 500)
            text("2", 550, 300)
            text("3", 500, 150)                
            if CurrentTouch.state == BEGAN then        
                if CurrentTouch.x >= 550-75 and CurrentTouch.x <= 550+75 and 
                    CurrentTouch.y >= 500-19 and CurrentTouch.y <= 500+19 then   
                    Level02WIN=true
                end 
            end                                   
                if Level02WIN then
                                               
                    
                          
                    
    -- Verzƶgerte Animation starten
      
                                -- das war tag 01
                                -- Jetzt kommt Tag 02!
                                    
        
                                    background(0, 255, 216)
                                
        fill(255, 0, 225)
    font("ArialRoundedMTBold")
    fontSize(50)
    text("Deine Insel", 550, 750)
    -- Hier die Buttons
    sprite(asset.builtin.UI.Blue_Button13, 850, 150, 110, 110)
    sprite(asset.builtin.UI.Blue_Button11, 850, 350, 110, 110)
    sprite(asset.builtin.Blocks.Cotton_Tan, 550, 700, 110, 110)
   -- sprite(Ads, 800, 750)
 sprite(GameAds, 150, 500)
    
    -- Hier die Texte
                                fontSize(25)
    text("Start", 850, 150)
    text("Editor", 850, 350)
    text("Island", 550, 700)
                                fontSize(10)
    text("Hier gibt's nicht viel zu sehen...", 150, 500)
                                
                       -- 
                
                
                
                         if CurrentTouch.state == BEGAN then        
                if CurrentTouch.x >= 550-75 and CurrentTouch.x <= 550+75 and 
                    CurrentTouch.y >= 700-19 and CurrentTouch.y <= 700+19 then   
                    Super=true
                end 
                end 
                
                
            if Super then
                    background(25)
                    text("Is that Possible?", 550, 700)
                end
             end               
            end end end
                            
                        
                        
                    
                
            

Now that you have it doing what you want, make changes to the existing code to make it do even more. Once you get the current code how you want, you can add new code a little at a time.

@dave1707 Okay, today Iā€™ll start with a new code. So actually I wanted to make a game with the code I showed you that I want to publish (first of all on play store because it is cheaper to publish a game and if I am so halfway famous I will also publish it on the app store) I will of course continue the game as I wrote to you. But I want to deal with animations now. I will probably need a lot of help, but I sometimes also do it with the Bing AI (programming but the Bing AI has never really helped me, only you actually)

Edit: I think Iā€™ll do something else (much too heavy :sweat_smile:)

@Bri_G @dave1707


viewer.mode = FULLSCREEN

function setup()
    BGcolor = color(255, 14, 0)
    txt1 = "Scissors, Stone, Paper!"
    Button = readImage(asset.builtin.Surfaces.Desert_Cliff_Normal)
end

function draw()
    -- Here, the Button's
    if not Paper then
        sprite(Button, 550, 300, 80)
        sprite(Button, 400, 300, 80)
        sprite(Button, 250, 300, 80)
        -- Here, the texte's
        
        fill(253, 255, 0)
        text("Paper", 550, 300)
        fill(146, 255, 0)
        text("Stone", 400, 300)
        fill(0, 255, 200)
        text("Scissor", 250, 300)
    end
    -- Touches
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 550-75 and CurrentTouch.x <= 550+75 and 
        CurrentTouch.y >= 300-19 and CurrentTouch.y <= 300+19 then   
            Paper = true
        end end 
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 400-75 and CurrentTouch.x <= 400+75 and 
        CurrentTouch.y >= 300-19 and CurrentTouch.y <= 300+19 then   
            Stone = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 250-75 and CurrentTouch.x <= 250+75 and 
        CurrentTouch.y >= 300-19 and CurrentTouch.y <= 300+19 then   
            Scissor = true
        end 
    end
    
    if Paper then
        
   background(BGcolor)
        print("SUSPECT")  
        print("Moin moin")
        print("nothing")
        fill(40, 0, 255)
        font("Baskerville-SemiBold")
        fontSize(40)
        text("AMOGUS", 550, 500)  
        fill(255, 237, 0)
        text("Paper", 550, 700)fill(255, 237, 0)
        text("Paper", 550, 700) 
    end
    
    if Scissor then
        fill(0, 255, 226)
        text("Scissor", 400, 700)
    end
    
    if Stone then
        fill(77, 255, 0)
        text("Stone", 250, 700)
    end
end

I thought with this code (which is of course from me) that it is very very small but 70 lines are actually normal. (No one is interested anyway)

@Killer.Jo - will look at your code when I get a chance, too tied up today.

@Bri_G Ok, not bad.

siu

@Killer.Jo - hereā€™s my attempt at setting the game management basics you mentioned.


-- KillerJoFarmer

viewer.mode = FULLSCREEN
function setup()
    --
    midX, midY = WIDTH//2, HEIGHT//2
    state = "started"
    butSize = 64
    stbutY = 880
    optbutX = 100
    optBLX = optbutX - butSize/2
    optBRX = optbutX + butSize/2
    stbutBC = vec2(midX-butSize/2, stbutY-butSize/2)
    stbutTC = vec2(midX+butSize/2, stbutY*butSize/2)
end

function draw()
    -- 
    background(40, 40, 50)
    font("Georgia-BoldItalic")
    fontSize(64)
    textAlign(CENTER)
    fill(236, 67, 75)
    if state == "started" then
        startPage()
    elseif state == "options" then
        optionsPage()
    elseif state == "option1" then
        background(69, 236, 67) 
    elseif state == "option2" then
        background(135, 85, 29)
    elseif state == "freezing" then
        icelandPage()
    end
    text(state,midX,midY)
end

function touched(t)
    --
    if t.state == ENDED then
        if state == "started" then
            if t.pos.x > stbutBC.x and t.pos.x < stbutTC.x then
                if t.pos.y > stbutBC.y and t.pos.y < stbutTC.y then
                    state = "options"
                end
            end
        elseif state == "options" then   
            if t.pos.x > optBLX and t.pos.x < optBRX then
                for lp = 1, 3 do
                    optBBY = 800-lp*70 - butSize/2
                    optBTY = 800-lp*70 + butSize/2
                    if t.pos.y > optBBY and t.pos.y < optBTY then
                        if lp == 1 then
                            state = "option1"
                            print(lp,state)
                        elseif lp == 2 then
                            state = "option2"
                            print(lp,state)
                        elseif lp == 3 then
                            state = "freezing"
                            print(lp,state)
                        end
                    end
                end
            end
        else
            state = "started"
        end
    end
end

function startPage()
    --
    spriteMode(CENTER)
    sprite(button[1],midX,880,butSize,butSize)
end

function optionsPage()
    --
    spriteMode(CENTER)
    state = "options"
    for lp = 1,3 do
        sprite(button[lp+1],100,800-lp*70,butSize,butSize)
        fill(255)
        font("AmericanTypewriter-Bold")
        textAlign(LEFT)
        fontSize(24)
        text("Option "..lp-1,200,800-lp*70)
    end
end

function icelandPage()
    --
    background(109, 176, 177)
    print(lp,state)
end

button = {
        asset.builtin.UI.Red_Button_00,
        asset.builtin.UI.Yellow_Button_00,
        asset.builtin.UI.Blue_Button10,
        asset.builtin.UI.Green_Button_00
        }

Hope thatā€™s OK and straightforward for you.

@Bri_G Iā€™ll try to do itā€¦

@dave1707 @Bri_G


-- Killer Jo Farm

function setup()
    -- Buttons "vorzeichnen"
    BGcolor = color(0, 229, 255)
    
    StartBTN = readImage(asset.builtin.UI.Green_Button_00)
    SkinBTN = readImage(asset.builtin.SpaceCute.Beetle_Ship)
    FarmBTN = readImage(asset.builtin.Platformer_Art.Block_Grass)
    BoxBTN = readImage(asset.builtin.Small_World.Watch_Tower)
    Character01 = readImage(asset.builtin.Planet_Cute.Character_Pink_Girl)
    -- Texte "vorzeichnen"
    
    StartTXT = "Start"
    SkinTXT = "Box"
    FarmTXT = "Farm (Island)"
    BoxTXT = "Your 2. Box"
    
    -- Coins
    Coins = 100
end

function draw()
    Start11=true
    -- Buttons Zeichnen
    -- Sprites
    if Start11 then
    background(BGcolor)
    sprite(StartBTN, 800, 150)
    sprite(SkinBTN, 800, 300)
    sprite(FarmBTN, 550, 700)
    sprite(BoxBTN, 200, 200)
    sprite(Character01,  550, 500)
    sprite(asset.documents.Monster, 550, 790, 50, 50)
    sprite(asset.builtin.Planet_Cute.Chest_Closed, 150, 500)       
    -- Texte Zeichnen
    
    fill(255, 27, 0)
    font("ArialRoundedMTBold")
    
    text(StartTXT, 800, 150)
    text(SkinTXT, 800, 300)
    text(FarmTXT, 550, 700)
    text(BoxTXT, 200, 200)
        
        fill(130, 30, 109)
        font("Arial-BoldMT")
        fontSize(50)
        text("Killer Jo", 150, 750)
        fontSize(20)
    end
    -- Die Touches
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 800-75 and CurrentTouch.x <= 800+75 and 
        CurrentTouch.y >= 150-19 and CurrentTouch.y <= 150+19 then   
            Start= true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 800-75 and CurrentTouch.x <= 800+75 and 
        CurrentTouch.y >= 300-19 and CurrentTouch.y <= 300+19 then   
            Skin = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 550-75 and CurrentTouch.x <= 550+75 and 
        CurrentTouch.y >= 700-19 and CurrentTouch.y <= 700+19 then   
        Farm  = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 200-75 and CurrentTouch.x <= 200+75 and 
        CurrentTouch.y >= 200-19 and CurrentTouch.y <= 200+19 then   
            Box = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 150-75 and CurrentTouch.x <= 150+75 and 
        CurrentTouch.y >= 500-19 and CurrentTouch.y <= 500+19 then   
            Shop = true
        end 
    end
    
    if Shop then
        background(62)
        if CurrentTouch.state == ENDED then
            if Coins > 99 then
                print("Item Buyed")
            end
        end
    end
    
    if Start then
        background(128)
        text("Hier! Ein paar Coins!", 550, 700)
        sprite(asset.builtin.Blocks.Glass, 550, 500)
       
        Coins = 0
         
        if CurrentTouch.state == ENDED then
            St= true
        end
         if St then
            Coins = Coins + 5    
    end
    end
    
    if Skin then
        background(85, 130, 61)
        text("Deine Skin-Box", 550, 700)
        sprite(asset.builtin.Planet_Cute.Character_Boy, 550, 500)
    end
    
    if Farm then
        background(138, 83, 79)
        text("Das ist deine Farm (Island)", 550, 700)
        sprite(asset.builtin.Blocks.Dirt, 550, 500)
        text("Warte 1 Min um grass zu erhalten!", 550, 300)
        
        tween.delay(60, function()
        pp=true 

        end)
        
        if pp then
            background(138, 83, 79)
        end
    end
    
    if Box then
        background(169, 149, 73)
        text("Das ist deine 2. Box", 550, 700)
        sprite(asset.builtin.Blocks.Dirt_Snow, 550, 510)
        text("Erledige 1 Mission!", 550, 400)
    end
   
    fill(255, 245, 0) 
    text(Coins, 1000, 750)
    text("Coins:", 800, 750)
   sprite(asset.builtin.UI.Blue_Box_Cross, 900, 650) 
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 900-75 and CurrentTouch.x <= 900+75 and 
        CurrentTouch.y >= 650-19 and CurrentTouch.y <= 650+19 then   
           Start11  = true
        end 
    end
    end

I actually wanted to make a back button at the very end of the code that makes you come back to the start menu but that didnā€™t work out for whatever reason would be very nice if one of you can do it so unfortunately I canā€™t do it.


 Killer Jo Farm

function setup()
    -- Buttons "vorzeichnen"
    BGcolor = color(0, 229, 255)
    
    StartBTN = readImage(asset.builtin.UI.Green_Button_00)
    SkinBTN = readImage(asset.builtin.SpaceCute.Beetle_Ship)
    FarmBTN = readImage(asset.builtin.Platformer_Art.Block_Grass)
    BoxBTN = readImage(asset.builtin.Small_World.Watch_Tower)
    Character01 = readImage(asset.builtin.Planet_Cute.Character_Pink_Girl)
    -- Texte "vorzeichnen"
    
    StartTXT = "Start"
    SkinTXT = "Box"
    FarmTXT = "Farm (Island)"
    BoxTXT = "Your 2. Box"
    
    -- Coins
    Coins = 0
end

function draw()
    Start11=true
    -- Buttons Zeichnen
    -- Sprites
    function StST()
    background(BGcolor)
    sprite(StartBTN, 800, 150)
    sprite(SkinBTN, 800, 300)
    sprite(FarmBTN, 550, 700)
    sprite(BoxBTN, 200, 200)
    sprite(Character01,  550, 500)
    sprite(asset.documents.Monster, 550, 790, 50, 50)
    sprite(asset.builtin.Planet_Cute.Chest_Closed, 150, 500)       
    -- Texte Zeichnen
    
    fill(255, 27, 0)
    font("ArialRoundedMTBold")
    
    text(StartTXT, 800, 150)
    text(SkinTXT, 800, 300)
    text(FarmTXT, 550, 700)
    text(BoxTXT, 200, 200)
        
        fill(130, 30, 109)
        font("Arial-BoldMT")
        fontSize(50)
        text("Killer Jo", 150, 750)
        fontSize(20)
    end
    -- Die Touches
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 800-75 and CurrentTouch.x <= 800+75 and 
        CurrentTouch.y >= 150-19 and CurrentTouch.y <= 150+19 then   
            Start= true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 800-75 and CurrentTouch.x <= 800+75 and 
        CurrentTouch.y >= 300-19 and CurrentTouch.y <= 300+19 then   
            Skin = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 550-75 and CurrentTouch.x <= 550+75 and 
        CurrentTouch.y >= 700-19 and CurrentTouch.y <= 700+19 then   
        Farm  = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 200-75 and CurrentTouch.x <= 200+75 and 
        CurrentTouch.y >= 200-19 and CurrentTouch.y <= 200+19 then   
            Box = true
        end 
    end
    
    if CurrentTouch.state == BEGAN then        
        if CurrentTouch.x >= 150-75 and CurrentTouch.x <= 150+75 and 
        CurrentTouch.y >= 500-19 and CurrentTouch.y <= 500+19 then   
            Shop = true
        end 
    end
    
    if Shop then
        background(62)
        if CurrentTouch.state == ENDED then
            if Coins > 99 then
                print("Item Buyed")
            end
        end
    end
    
    if Start then
        background(128)
        text("Hier! Ein paar Coins!", 550, 700)
        sprite(asset.builtin.Blocks.Glass, 550, 500)
       
        Coins = 0
         
        if CurrentTouch.state == ENDED then
            Middion01=true
        end
        if Middion01 then
        Coins = Coins + 5
            background(233, 147, 80)
            text("Sxhlage So oft du kannst den Charakter um ihn FREIZUSCHALTEN!!!", 550, 700)
        
         end
    end
    
    if Skin then
        background(85, 130, 61)
        text("Deine Skin-Box", 550, 700)
        sprite(asset.builtin.Planet_Cute.Character_Boy, 550, 500)
    end
    
    if Farm then
        background(138, 83, 79)
        text("Das ist deine Farm (Island)", 550, 700)
        sprite(asset.builtin.Blocks.Dirt, 550, 500)
        text("Warte 1 Min um grass zu erhalten!", 550, 300)
        
        tween.delay(60, function()
        pp=true 

        end)
        
        if pp then
            background(138, 83, 79)
        end
    end
    
    if Box then
        background(169, 149, 73)
        text("Das ist deine 2. Box", 550, 700)
        sprite(asset.builtin.Blocks.Dirt_Snow, 550, 510)
        text("Erledige 1 Mission!", 550, 400)
    end
   
    fill(255, 245, 0) 
    text(Coins, 1000, 750)
    text("Coins:", 800, 750)
   sprite(asset.builtin.UI.Blue_Box_Cross, 900, 650) 
    
    if CurrentTouch.state == ENDED then        
        if CurrentTouch.x >= 900-75 and CurrentTouch.x <= 900+75 and 
        CurrentTouch.y >= 650-19 and CurrentTouch.y <= 650+19 then   
           StST()
        end 
    end
    end

I changed the code but when you open a menu and then go out again (my problem was that when you clicked on the back button that you donā€™t return to the main menu) that if you click again you come back to the same menu

@Bri_G @dave1707 Uh, somehow none of you answer

@Killer.Jo You seem to be doing OK. You know how to do the buttons and screens so you donā€™t need us to do it for you. Just keep it small until you fully understand what youā€™re doing.

1 Like

@Killer.Jo - just looking at your code, will respond when I have played a little with it.

1 Like

@Bri_G Okay, Iā€™ll wait. In the meantime, Iā€™m making an app with math.random because Iā€™m interested

@Bri_G @dave1707
Here the ā€žmath.randomā€œ code


-- math random is randomly cool

function setup()
    Mystery = math.random(1, 100)
    BGcolor = color(255, 0, 195)
end

function draw()
    background(255)
    text(Mystery, 550, 300)
    sprite(asset.builtin.Blocks.Redstone, 550, 500)

    if CurrentTouch.state == ENDED then
        random=true
    end
    if random then
    if Mystery < 10 then
            background(BGcolor)
            sprite(asset.builtin.Blocks.Stone_Coal_Alt, 550, 500)
        end
    
    if Mystery > 10 then
            background(BGcolor)
            sprite(asset.builtin.Planet_Cute.Enemy_Bug, 550, 500)
        end
        
        if Mystery > 30 then
            background(BGcolor)
            sprite(asset.builtin.Planet_Cute.Gem_Orange, 550, 500)
        end
        
        if Mystery > 50 then
            background(BGcolor)
            sprite(asset.builtin.Planet_Cute.Gem_Blue, 550, 500)
    end
    end
    
end

@Killer.Jo Thatā€™s the way to do it. Try different small things to see what they do. Eventually youā€™ll have enough that you can combine them into larger programs.