Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/532725438804545536
added 23 characters in body
Source Link
BungleBonce
  • 1.9k
  • 2
  • 34
  • 69

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen
added 17 characters in body
Source Link
BungleBonce
  • 1.9k
  • 2
  • 34
  • 69

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene'

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen
Source Link
BungleBonce
  • 1.9k
  • 2
  • 34
  • 69

Saving an interface instance into a Bundle

All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene'

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen