Scenes Resetting

SkyPilot

  • Posts: 34
Hi,

My player can walk around a scene and when he collides with an enemy, they switch to a Battle Scene (think pokemon). When the battle finishes, we return to the walk around scene, but the enemy we just killed is there again and my player is at the starting point, not where he engaged in battle. How do I change this?

Luyren

  • *
  • Posts: 2810
Store the player's coordinates in a game attribute, and set its position to those coordinates when you return from the battle scene.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

NerdinaNutshell

  • Posts: 251
Be sure to use a game attribute, not a scene or an actor one.
*Puff*

SkyPilot

  • Posts: 34
Thanks so much for this, after many failed attempts, it works!
One more question though: For my enemy to be killed when I'm back at the scene, I created a game attribute. Simple enough.
My question is, will I have to create a game attribute for every single enemy in the game for them to die? Is there a way to use behaviours for this? 

Thanks

Luyren

  • *
  • Posts: 2810
Use one game attribute of type list, and add the actor and the current scene as a single string to that list. Then, on a created event in a behavior you attach to your enemies, check if the list contains that actor and that scene. If it does, kill the actor.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

SkyPilot

  • Posts: 34
Thanks for the suggestion. Could you link me to any tutorials on those? I only know a tiny bit about behaviours and nothing about lists.

Luyren

  • *
  • Posts: 2810
Lists: http://www.stencyl.com/help/view/lists/
And just read the Stencylpedia in general, that has a lot of information.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.