get rts speed

This forum is currently in read-only mode.
From the Asset Store
10 isometric and animated Strategy Game Buildings in two Colors.
  • How would i get current speed of the object using rts behavior. Basicly i just want to slow down the object.

    Like this:

    set rtsspeed to rtsspeed-10

  • Hi. Construct lets you select from many expressions from any text entry field that accepts those, such as the 'Set speed' action.

    In case you don't know about any of these, I'll describe the process below.

    Also, even object selection gadgets can be right-clicked and 'Use expression' can be selected. This would be the action (copied as text from Construct) for doing what you mentioned, if the sprite were named 'Unit':

    -> Unit: Set speed to Unit[RTS].Speed - 10

    You can access that 'Unit[RTS].Speed' using the mouse by doing the following:

    • click 'new action' in the event sheet
    • double-click the sprite with RTS behavior (named 'Unit' in the above case)
    • click the 'RTS' tab at the top
    • double-click 'Set speed'

    Here's where you can access a multitude of 'expressions' that Construct provides. You can either just type them into the text entry, or select them from the usual list, or a combination of those is usually the case. From here:

    • double-click the sprite again in the object view at the bottom of the window. This brings up all of the expressions for it.
    • select the 'RTS' tab as before to get those specific to that behavior
    • double-click 'Get speed'

    Now just type in ' - 10' to the end of it.

    The System object also has many useful expressions to use in such a way.

  • ah sry, i was actually wanting to get rts speed from a family, i forgot to mention that.

    But thanks nevertheles. this helped Unit[RTS].Speed

    Can i pull anything with behavior with [behname] for families?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah. Well, it should work the same way for a family. With family 'Red':

    -> Red: Set speed to Red[RTS].Speed - 10

    just select the family in place of the sprite.

    There is a completely non-obvious method that you may have to use in place of the above:

    - double-click the sprite again in the object view at the bottom of the window. This brings up all of the expressions for it.

    in order to be able to select the family, though... If the family is not in that list, you can double-click an empty spot in the little window to bring up a new window with all of the objects and families, and select it there.

    Or just type it in if you already know the syntax.

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