Okay I have a problem that is driving me mad. So in my game in had the set up and all then I choose that it needed to have a menu it started on so I moved the setup and draw to a new file and renamed the setup (and made a new one) but now it keeps saying error the line that the setup was on before can you please tell me who to remove this error.
To clear a sprite off the screen, you stop drawing it. To have a scene start drawing, you start drawing it. Your question isn’t very clear as to what you’re trying to do.
@pac - to switch sprites on and off you need a conditional check …
If condition == true then
show sprite
else
Dont show sprite
end
You obviously need to add your own code, you may want to move the sprite, change it move to another page if your sprite is a button. All in draw() function or a sub function called within the draw function.
if GameMode == 1 then
--draw the sprite for the start button
if i < 120 then
sprite("Project:entry001", 500, 500, 200, 200)
end
i = i + 1
end
print(i)
end
This function gets called by the draw function but the sprite does not go away after i go over 120 so please help me know ho to get the sprite to go away.
@pac - check to see if you modify i in your other code, it looks like a global. If it resets to 0 or 1 then you will never stop it displaying hence the flash when
I == 121.
Also, it looks like you may be waiting for a start button to be tapped. You should set that code up in the touched(t) function. Without seeing most of your code we can’t see where the error is.
@pac Here’s an example of switching screens. Slide the switch to switch screens.
function setup()
parameter.boolean("switch",false)
end
function draw()
background(0)
if switch then
screen2()
else
screen1()
end
end
function screen1()
background(223, 171, 154, 255)
fill(255, 0, 0, 255)
text("Screen1",WIDTH/2,HEIGHT-200)
sprite("Planet Cute:Character Horn Girl",WIDTH/2,HEIGHT/2)
end
function screen2()
background(169, 222, 188, 255)
fill(255, 0, 0, 255)
text("Screen2",WIDTH/2,HEIGHT-200)
sprite("Small World:Court",WIDTH/2,HEIGHT/2)
end