pass Values from an Array to a Behaviour

Get help using Construct 2

Post » Thu Jan 30, 2014 1:07 pm

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
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Thu Jan 30, 2014 1:13 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 30, 2014 1:46 pm

@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
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Thu Jan 30, 2014 2:53 pm

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.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487


Return to How do I....?

Who is online

Users browsing this forum: FabianB, ST314 and 31 guests