Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Help to Change Scenes [Visual Editor]

Author
Message
AdamRyan
User Offline
Joined: 13th Dec 2017
Location:
Posted: 13th Feb 2018 11:29
Hello there,

In my project I start with Scene2 (start screen)

+ Code Snippet

On click I want to go to the game (scene 1)
+ Code Snippet

While this does change scene, scene1 starting positions load but there is no animation and limited functionality. Do I need to do something else to activiate scene1 sprites OR is there a problem elsewhere in my code?
smallg
Valued Member
12
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 13th Feb 2018 18:05
By default sprites created by the visual editor have animations etc turned off
You need to call
SetSpriteActive(id,1)
When you set up the animations.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
AdamRyan
User Offline
Joined: 13th Dec 2017
Location:
Posted: 14th Feb 2018 09:48
Thanks! Wil check it out!
AdamRyan
User Offline
Joined: 13th Dec 2017
Location:
Posted: 14th Feb 2018 11:29
Sorry the documentation is not great (as far as I know ) for the Vis Ed....

When changing scenes it seems I also have to make all sprites have visibility = 0 too?

I am failing to see the purpose of the set scene if on exit I have to make sprites invisible and on entry I have to make sprites active.... am i doing things wrong?

Anyone with a link to decent docs?
smallg
Valued Member
12
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 14th Feb 2018 21:30
do you mean for the previous scene? no just make sure you have it set to load_for_scene or whatever it was and not load_all when it first calls the set up function.
if you have created your own sprites in AppGameKit code then yes you will need to delete (or whatever) those, the scene change will only handle sprites and text etc created by the visual editor.

you can always just open the file where it handles the set up of the sprites and take out the part that says SetSpriteActive(id,0)
the visual editor is not a completed product unfortunately.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
AdamRyan
User Offline
Joined: 13th Dec 2017
Location:
Posted: 14th Feb 2018 22:41
thanks smallg!

I hadnt thought it through properly! Yeah of course some sprites were moving fine.... they were the clones!!!!

Nice tip about editing the source files created by VIsEd, i have had a look and they seem pretty easy to hack around with BUT until (i presume it doesnt exist yet) i can set some master variables the problem with altering their files is that on each 'run' from VIsEd the files are rewritten from scratch. Safer for now to hard code my changes into my code.

Thanks again!
smallg
Valued Member
12
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 15th Feb 2018 00:16
as long as you save iany changes to your scenes n the visual editor you can simply run from inside agk as normal, that way it won't overwrite the files.
the run button in the visual editor doesn't open the app for me so i never use it.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
AdamRyan
User Offline
Joined: 13th Dec 2017
Location:
Posted: 15th Feb 2018 00:18 Edited at: 15th Feb 2018 00:20


FOR REFERENCE, I used the following to move scenes between 3, if you want to use/abuse/criticize/improve then feel free

scene 1 = main game
scene 2 loading intro
scene 3 game over screen with click to replay
+ Code Snippet

Looking forward to hearing how things could be much better for this beginner!

Thx again smallg!

Login to post a reply

Server time is: 2018-02-22 08:59:07
Your offset time is: 2018-02-22 08:59:07