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.

AppGameKit Studio Chat / Agk studio - move between scenes

Years of Service
User Offline
Joined: 29th Aug 2017
Posted: 29th Mar 2019 06:52 Edited at: 29th Mar 2019 07:06
Hi Guys
Play around with AppGameKit Studio 0.50beta

What will be the correct code for moving between scenes.
If have this code (In the main loop, but don't seems to work

// Project: testbackground
// Created: 19-03-29

// show all errors

// set window properties
SetWindowSize(1024, 768, 0)
SetWindowAllowResize(1) // allow the user to resize the window

// set display properties
SetVirtualResolution(1024, 768) // doesn't have to match the window
SetOrientationAllowed(1, 1, 1, 1) // allow both portrait and landscape on mobile devices
SetSyncRate(30, 0) // 30fps instead of 60 to save battery
SetScissor(0, 0, 0, 0) // use the maximum available screen space, no black borders
global activescene

#include "mainscreen.scene"

if getpointerpressed() = 1
if spritehit = mainscreen_exitbtn
elseif spritehit = mainscreen_backg1btn
#include "movebackground1.scene"
activescene = 1
elseif spritehit = mainscreen_backg2btn
#include "bacground2.scene"
activescene = 2
if activescene = 1
if activescene = 2

Years of Service
User Offline
Joined: 29th Aug 2017
Posted: 29th Mar 2019 09:22
Had a complete brainfreeze
I suppose deleteallsprites(), and deleteallimages() will do the job

Time for a break...
AGK Studio Developer
Years of Service
User Offline
Joined: 30th Jun 2004
Posted: 29th Mar 2019 13:04
Hi Danny,

Yes you can do that for now , i will add a scene_cleanup() for the next version
Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 29th Mar 2019 13:36
Quote: "Yes you can do that for now , i will add a scene_cleanup() for the next version "

Cool. If you can add scenefading i.e. fading into and out of scenes it would help with the overall look and feel of finished apps.
Imaginations' greatest gift is the knowledge you supply it.
User Banned
Posted: 29th Mar 2019 14:56
I think a better way than fading into another scene... is like the simple movie maker windows had possed in the past.

a small editor likes a window with the ability to:
1. select the animation between scenes and between particular scenes such as moving back to the main menu should be different from one level to another.
2. the ability to customize the Tween Animation, so well I think that is the answer a bit of better tween animation commands, adding the createTweenScene and playTweenScene
3. an editor like mention in 1 with the ability of the Tween Commands I think is the best solution for too many reasons which the best of them is 1 the ability to customize everything and 2nd to make it like the normal tween, good for coding and best for cross-platform as it depends on a Timer rather than FPS

and well.. the ability to select individual elements inside a Scene and manipulate them through the scene crossing.
Years of Service
User Offline
Joined: 5th Jul 2009
Posted: 29th Mar 2019 16:45 Edited at: 29th Mar 2019 18:04
Quote: "i will add a scene_cleanup() for the next version"

I would like to recommend in order to keep the Tier1 syntax consistent, name it SceneCleanup() instead of scene_cleanup().
I would also recommend to add SceneGoTo("scene ID or Name") command, so it would go ahead, clean the current scene and setup and load the next one entered between the () just for convenience.

However, the next thing most people going to request is the ability to be able to pause/save the current scene, go to another and then be able to go back to a paused/saved scene anytime. So I would also recommend to look in to this scenario and add ScenePause() or SceneSave() command, that is going to save the current scene at the current state permanently. You probably don't want to overwrite the original data however, in case the player want to start a new game from fresh. So you more likely want to save an instance of the current scene and maybe add a command SceneResume("scene ID or name") that is going to look for an instance of the scene with the given name or ID rather than the original. If no instance found, that could mean the given scene has not been paused/saved before and could add a fall back option to load the original data then or add an overload so we can choose if we want it to fall back to original scene if no instance found or not. Something like SceneResume("ID or Name", bool fallback).
Or simply let us save an instance of the current scene with a selected name. Something like SceneSave("name") which is going to save an instance of the current scene at the given name, and then we could load this scene as any other scenes.

Since you already considering to work on this area of "switch scenes", I figured I mention this and suggest to consider it and get it out of the way now for convenience.
I think it would be very useful.

Years of Service
User Offline
Joined: 9th Jan 2018
Posted: 30th Mar 2019 15:19
Is the #include part where the scenes are loaded into memory?

Login to post a reply

Server time is: 2023-06-02 23:45:45
Your offset time is: 2023-06-02 23:45:45