How do I do this create enemy and variable style

0 favourites
  • 4 posts
From the Asset Store
Background Story generation templates. See the Arcade demo.
  • Ok so my idea and yes if you were following my other post i am still working on that same turn based.

    ATM I am trying to figure out how to implement a monster attackQue system. Now keep in mind These monster are create not already there.

    And the number of monster is going to be randomly created from 1-5.

    How would i go about getting a brand new variable to each created. in other word If each monster is create then add one to a family of monster but i would like it to be like this for each sprite monster created have the variable to be in order of 1 2 3 4 5. So that when i do the monster Que each monster would have a turn. Because this is created and not already there how would i math out the variable so that it can be 1 2 3 4 5 on each new create sprite.

    Again this is for the monster attack que. I already got a plan on how to get the event to run them its just because they are created how will i add in variable in that matter.

  • Make a global variable (example monsterNumber) and set its value to 1 before each spawning of monsters.

    Give each monster an internal (instance) variable (example myNumber) and initialize it to 0 after every fight (and on start of game).

    Now when spawning monsters assign the first one's myNumber the value of monsterNumber and then increment monsterNumber by 1. Repeat for number of monsters.

    Now you just have to use your Family/monster myNumber compare to activate.

  • You are a genius. I would have never guess to use global variable like that Question can I use local variable as It will be use on one set of layout and not the others ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you not using it globally then yes make a instance variable holder.. aka invisible sprite and use it to hold your monsterNumber local variable.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)