get rts speed

For questions about using Classic.

Post » Sat Jul 31, 2010 12:13 am

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
B
3
G
4
Posts: 54
Reputation: 1,183

Post » Sat Jul 31, 2010 1:36 am

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.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sat Jul 31, 2010 1:51 am

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?
B
3
G
4
Posts: 54
Reputation: 1,183

Post » Sat Jul 31, 2010 1:59 am

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.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 10 guests