Creating instances w/ specific behavior properties

Get help using Construct 2

Post » Thu Mar 22, 2012 2:37 pm

Heya folks,

I hope the title speaks for itself. I've created an object called SinBlock, which is a rectangle with both solid and sine as behaviors. What I'm trying to do is figure out how to create another of these blocks with the System->Create action with specific properties in the instance behavior.

You see, whenever I create an instance with the System-action it creates one from some default values, such as horizontal movement with a period of 4 seconds and a magnitude of 50 pixels which is understandable. The problem is I'm not allowed to change some of these sine properties of the new instance using action commands (regardless of if I've picked it or not). For example, the only sine behavior properties I can change on the instance are if it's active, the magnitude and the period but not if I want the instance to be at a specific period offset, or change the movement direction from horizontal to vertical.

This makes it very difficult to create instances of the desired object in runtime. Is there a way to do this, or at least to change the default values of an objects' default behavior properties?

I'd post my current .capx but it's a huge, barely commented mess that'd probably offend any person trying to help me so I'll just stick around here instead. I hope my question was clear enough. If not, ask any questions and I'll answer right away.

To be more clear on how this'd help my current project:
I'm working on a part of a level where the player stands on an elevator that goes down a shaft, having to evade objects that come from beneath. The "elevator" or block that goes down the shaft is a solid object with a sine behavior that I've created so it starts at its highest (period offset) and goes down at a specific speed (tweaked through magnitude and total period values).

The reason why I want to be able to create a new instance of this object, or be able to change the defaults of it is that I want to be able to reset the objects in the elevator shaft in case the player dies while going down the shaft (if the player dies, he gets teleported to a checkpoint before the shaft). And since I couldn't find a "reset position"-action for the sine behavior I'm at a loss.

I'm not sure if I've just been searching with the wrong keywords or if I've just missed the relevant forum thread but I can't find anything on either the manual or the forum on changing instance behavior properties. If I've missed it, I'm really sorry for wasting your time.


Thanks for anyone who to took the time to read this through!


TL;DR - How can I change default instance properties that are specific for certain behaviors? Or how can I create instances of objects with specific behavior properties?
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Thu Mar 22, 2012 3:46 pm

Hmm... all behaviors should have a full set of actions and expressions to set and get all properties, and then you would just set them after creating the object. I've added to my todo list to make sure Sine behavior can have all its properties set with actions. Are there any other behaviors missing actions?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Thu Mar 22, 2012 4:01 pm

That's the only one I've noted so far that's missing its properties in the action-list.

I worked my way around it by changing it to a bullet behavior instead, though so there's no stress on that. It doesn't have the smooth acceleration and deceleration that I automatically got with sine movement, but it's good enough for what I'm doing. Thanks for the quick response, Ashley! Now I don't have to think about that anymore.
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Tue Sep 25, 2012 10:08 pm

@Ashley I just ran into this exact problem (trying to set the sine behavior period offset in an event). Is it still on the todo list?
B
7
S
1
Posts: 74
Reputation: 1,232

Post » Sun Apr 27, 2014 12:06 am

@Ashley Bump! A Set Period Offset action would be a great boon to my current project. Currently using awkward workarounds, like using the Wait action followed by Set Sine Active on the specific instances I want delayed, and it doesn't always get the intended effect.
B
18
S
4
G
4
Posts: 68
Reputation: 3,127


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, signupdemo and 0 guests