pass Values from an Array to a Behaviour

0 favourites
  • 4 posts
From the Asset Store
Assets for creating mountains and ravines environments
  • hey guys!

    in my game, there are multiple rounds. and between every round, the player goes to another layout where he can improve his stats, these are then saved into a global array and if he presses "ready" he goes back to the first layout.

    now i want to set for example the bullet speed (of the Behaviour) to the value fornthe expression array.At(2,5).

    if i do it with

    on start of layout -> set player bullet speed to array.At(2,5)

    the bullet speed instatnly changes back, like it changed just for the exact moment when the layout started and then turned back.

    if i do this with "every tick" it works, but im not a fan of "every tick" especially because this is gonna be a mobile device game.

    is there a way to override the value for bullet speed for example with an expression?

    thanks in advance!

    cheers, phil

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are there any other events overruling the change of bullet speed?

    What are the settings for acceleration?

    Is bullet enabled and or disabled?

    For it sounds like what you are trying to do should work if there are no conflicting events.

  • LittleStain

    the initial state is enabled, theres no acceleration and theres no other event that is changing anything for this value.

    the only special thing about it, is that there is a family instance variable expression in it.

    on start of layout -> all_chars -> set bullet speed to engine.At(all_chars, 7)

    all_chars is a family because i use this one event to assign values for every character.

    but i dont think this is the problem because if i do "every" tick, its working

  • ok i think i figured it out. the settings of my behaviours seem to reset every time my character dies. and on my start of layout i clear everything on the screen to build it up from the ground.

    i think to use "on [families] created" is the way to go.

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