I have a stupid question whose answer I can't find.
If I run my code in 'display mode Fullscreen no buttons' then how can I return back to my code editing page without closing codea? I couldn't find any way to do so.
@Briadfox I've actually been treating the recording ability as a "hidden feature" of the apps I put out. I mention it on the support page, so that those people who come to the web site get a little nugget of insider info.
I've been altering images and the library to make the buttons fit my app... For instance, you can change the save image/video dialog images to match your app.
Does anyone know how you can call the reset function without touching the reset button?
This way, i could have FULLSCREEN_NO_BUTTONS and still be able to reset
I made a function such that when the program is over then if I touch the screen the program will start again like so
Setup()
ProgramOver = false
.
.
.
.
--your code
--if your program is over call return function
function return()
If ProgramOver then
Setup()
end
end
-- and add a touch function where you will make ProgramOver true
function touched(touch)
If ..then --add a condition which happens when your program is over like for a game when lives 0
If touch.state==BEGAN then
ProgramOver = true
end
end
end
@Saurabh - That is not an ideal way to do it. You may create variables outside of the setup() or in functions. I do it by creating classes for scenes that have an initiation, draw, and exiting functions. Then, I have a function to change the scene, and it calls the exit function on the previous scene and calls the initial function for the current screen and starts drawing it. If that's confusing, I'll share some code.
@JakAttak Like @Zoyt said, if you create anything outside of setup() it can lead to problems. It will work on the small scale but as you add more classes and your program gets bigger, it will be a problem.
--# Mainfunction setup()
parameter.integer("Current scene",1,3,1,function(s)if s ==1then
changeScene("start")elseif s ==2then
changeScene("game")elseif s ==3then
changeScene("gameover")endend)endfunction draw()
background(40, 40, 50)
scene:draw()endfunction changeScene(s)if scene ~=nilthen
scene:exit()endif s =="start"then
scene = Start()
sID = s
elseif s =="game"then
scene = Game()
sID = s
elseif s =="gameover"then
scene = GameOver()
sID = s
elseprint("Invalid scene name")endend--# Start
Start = class()function Start:init()print("start")endfunction Start:draw()
text("Start screen",WIDTH/2,HEIGHT/2)endfunction Start:exit()print("exit")end--# Game
Game = class()function Game:init()print("start")endfunction Game:draw()
text("Game screen",WIDTH/2,HEIGHT/2)endfunction Game:exit()print("exit")end--# GameOver
GameOver = class()function GameOver:init()print("start")endfunction GameOver:draw()
text("Game over screen",WIDTH/2,HEIGHT/2)endfunction GameOver:exit()print("exit")end
Again, there's nothing wrong with your version, I'm just a neat freak, and your method can lead to an incomplete reset of your game. Thanks!
@Ignatz - Great! Thanks. By the way, in this code block, the quotes don't appear correctly:
function changeScene(s)if scene ~=nilthen
scene:exit()endif s =="start"then
scene = Start()
sID = s
elseif s =="game"then
scene = Game()
sID = s
elseif s =="gameover"then
scene = GameOver()
sID = s
elseprint("Invalid scene name")endend
@Zoyt What is the meaning of this line : sID = s.
I like your idea I was looking for somethng like this. :-)
Is there a program whith this structure available somewhere?
@Ignatz I was not sure of that. The parameter s is used 2 times in the example . In the setup as type number and in the function changeScene as type character(s). I do not like it ,if you do that in a large program it is very difficult to debug. Can you change it in your tutorial, then you have a "clean" example program and better to understand.
@Dreamdancer - Haha... I didn't catch that. What I'm doing in the setup with the parameter.integer is declaring the local variable name to pass the current number on the slider in the callback function. The version of s that is passed into changeScene() is the name of the scene to change to. A little confusing, sorry.
Comments
Do a three-fingered triple tap on the screen. The buttons should reappear.
Any way to disable the three button tap so it can't be opened when exported into xCode?
Thanks it worked
@Briadfox I've actually been treating the recording ability as a "hidden feature" of the apps I put out. I mention it on the support page, so that those people who come to the web site get a little nugget of insider info.
I've been altering images and the library to make the buttons fit my app... For instance, you can change the save image/video dialog images to match your app.
Hi,
you can also use the function :
It will quit to your code editing page
Does anyone know how you can call the reset function without touching the reset button?
This way, i could have FULLSCREEN_NO_BUTTONS and still be able to reset
I made a function such that when the program is over then if I touch the screen the program will start again like so
@Saurabh - That is not an ideal way to do it. You may create variables outside of the setup() or in functions. I do it by creating classes for scenes that have an initiation, draw, and exiting functions. Then, I have a function to change the scene, and it calls the exit function on the previous scene and calls the initial function for the current screen and starts drawing it. If that's confusing, I'll share some code.
@Zoyt what is wrong with @Saurabh 's way? I tried it and it appears to work
@zoyt What are you using for your exit() function?
@JakAttak Like @Zoyt said, if you create anything outside of setup() it can lead to problems. It will work on the small scale but as you add more classes and your program gets bigger, it will be a problem.
@Briarfox Well I have 12 classes but I don't see anything wrong happening when I use this
There's nothing wrong with it, it just can lead to bad coding skills. Let me extract my scene manager and share it.
OK, thank you
Here is the code:
Again, there's nothing wrong with your version, I'm just a neat freak, and your method can lead to an incomplete reset of your game. Thanks!
@Zoyt - I hope you don't mind, I used your code for a tutorial post here
https://coolcodea.wordpress.com/2013/05/04/47-game-template/
with attribution of course =D>
@Ignatz - Great! Thanks. By the way, in this code block, the quotes don't appear correctly:
@zoyt - yes, I know, $&!?**#% WordPress messes up quotation marks.
I changed them all to single quotes
@Zoyt What is the meaning of this line : sID = s.
I like your idea I was looking for somethng like this. :-)
Is there a program whith this structure available somewhere?
@Dreamdancer - sID=s simply stores s in a variable so we can tell what state we are in
@Ignatz I was not sure of that. The parameter s is used 2 times in the example . In the setup as type number and in the function changeScene as type character(s). I do not like it ,if you do that in a large program it is very difficult to debug. Can you change it in your tutorial, then you have a "clean" example program and better to understand.
@Dreamdancer - Haha... I didn't catch that. What I'm doing in the setup with the parameter.integer is declaring the local variable name to pass the current number on the slider in the callback function. The version of s that is passed into changeScene() is the name of the scene to change to. A little confusing, sorry.