TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
Make a game start from level but then from menu as you close and reopen the game
Pages:
1
Make a game start from level but then from menu as you close and reopen the game
Jovial Games
Posts: 132
June 14, 2018, 07:15:42 pm
Hey guys,
I'm working on creating a mobile game for android and iOS. I was wondering if I can make a mechanic that when a user freshly opens my game it starts from the level but then when he closes the app completely and reopen it, it starts from the main menu instead of the level.
Is there a way to make this mechanic? If so, can you please guide me thoroughly how to do it?
Thanks!
merrak
Posts: 2738
June 14, 2018, 09:34:57 pm
You could set a boolean game attribute when the app is launched. Save it and when the app loads, check for its value. If it is set true then you know the game has been opened before and can direct the player to the menu instead of the first level.
`/\=======/\"-
Website! -
http://www.anorthogonaluniverse.com
Facebook -
http://www.facebook.com/rlwatson
Twitter -
https://twitter.com/merrak
Jovial Games
Posts: 132
June 18, 2018, 04:30:26 am
This would go like
if the boolean game attribute is true value
When created
set SwitchtoMenu = false
save game
load saved game
if SwitchtoMenu = false
switch scene to mene
Is this right? Cuz for some odd reason this isn't working for me
Luyren
Posts: 2802
June 18, 2018, 05:48:25 am
Use the load game block before everything else.
My Stencyl resources are available here:
https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
designpeg
Posts: 731
June 18, 2018, 08:14:02 am
You can use the loses focus and regains focus blocks (loses focus fires when you close a game, or answer call etc), the code may not run until you go back to it, Regain should be self explanatory.
Jovial Games
Posts: 132
June 20, 2018, 04:23:17 pm
Will it be like
When updating
load saved game
set SwitchtoMenu = False
save game
if SwitchtoMenu = False
Switch scene to Menu
What's better? when updating or when created?
Luyren
Posts: 2802
June 21, 2018, 09:34:19 am
When Created
-Load Game
--If SwitchtoMenu
Switch to Menu Scene
--Otherwise
Set SwitchtoMenu to true
Save Game
This ought to work.
My Stencyl resources are available here:
https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Jovial Games
Posts: 132
June 21, 2018, 09:44:39 am
Thank you Luyren!
I really appreciate this
Pages:
1