Omnipresent actor?

Is there a way to always have an actor instantiated, instead of having to drag it in for each scene?

Thanks!

Comments

  • TheGabfatherTheGabfather Member Posts: 633
    edited April 2014

    Yes, you can Spawn Actors (but you need at least one other Actor to do the Spawning).
    You do this by using the Spawn Actor Behavior.

    Although, before the Rule activates, the Actor-to-be-spawned is technically still non-existent. So I don't think it's correct to call it omnipresent.

    edit: It seems to me like you're creating a game with multiple Scenes having similar layouts/gameplay? Like one Scene per level? If so, then you can check out this video tutorial:

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You can copy scenes. Set up a scene the way you want it with one or more actors and then duplicate it (option+drag on a Mac so I would guess alt+drag on a PC).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • kkoenigkkoenig Member Posts: 10

    thanks to you both!

  • stueynetstueynet TorontoMember Posts: 166

    @kkoenig said:
    Is there a way to always have an actor instantiated, instead of having to drag it in for each scene?

    Thanks!

    I have a good method for this now. Working on my third game and finally getting a structure together that allows for expandability. I am planning on putting together a boilerplate with a tutorial in the next month or so.

    The basic gist is that you have a game controller for global game management. Things like running game over sequences, resets etc... But the issue with GS is that you can only spawn an actor on the SAME layer as the spawning actor. Thus you need a spawner for any layer that will received spawned actors.

    Then depending on your game you have a spawner for each major "Layer" in your scenes. So an example in my current game which has around 80 levels I have (in order from top to bottom):

    HUD Layer

    • Hud Controller (spawns the pause / score etc...)

    Level Layer

    • level elements
    • player
    • enemies
    • Level Controller (powerups, coins etc...)

    Background Layer

    • Background Controller (background, parallax etc...)

    Control Layer

    • Game Controller (must be at the bottom of the stack for things to work best)

    With this structure I just have to drop all the actors into their respective layers in each scene. Then if I need more logic across all scenes, I just edit one of the 4 actors. its possible to do it with less or more depending on the complexity of your game but the general idea is to have an actor prototype that exists in all scenes. Then if you have specific layer spawning requirements, create additional controllers for each layer.

    My Latest GS Game - Tiny Spirit
    My First GS Game - Dashing Ralph

  • kkoenigkkoenig Member Posts: 10

    I think this is exactly what I needed, thank you!

  • kkoenigkkoenig Member Posts: 10

    would you by any chance have a sample I could look at?

Sign In or Register to comment.