Creating instances w/ specific behavior properties

0 favourites
  • 5 posts
  • 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.<img src="smileys/smiley6.gif" border="0" align="middle" /> 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?

  • 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?

  • 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. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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