Skip to content

Possible to initialize an FlxState with different data for each level? #2477

Answered by RichardBray
ChillyCider asked this question in Q&A
Discussion options

You must be logged in to vote

I guess the answer to this question depends on how you're loading up your FlxStates.

  1. If you're using FlxG.switchState. You can pass arguments into your level like this:
  FlxG.switchState(new LevelOne(argument1, argument2));

Then you can load the arguments into your class constructor.
Happy to explain more if it doesn't make sense.

  1. If you have an array of states then check out this thread:
    #2400

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ChillyCider
Comment options

@Gama11
Comment options

@Geokureli
Comment options

@ChillyCider
Comment options

Answer selected by ChillyCider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants