Add Obstacle via UID?

Get help using Construct 2

Post » Fri Sep 06, 2013 8:41 am

Hi,

could someone help me how to add an Obstacle like Object(UID) instead of all instances?

Many thanks :)
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Sep 06, 2013 8:52 am

Add obstacle into the pathfinding behaviour?

On condition, pick the instances you want to add. Then for each instance, add as obstacle.

Example:

Condition
Pick all ObstacleSprite.
ObstacleSprite.X > 100.
    Sub-Event               Action
      For each Sprite.      PathfindingSprite:Add obstacle ObstacleSprite.
c4sp3r892013-09-06 08:53:54
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Sep 06, 2013 9:03 am

Thanks.

But I need it exactly the other way; I want to add one instance of an object to the one picked in the condition, such as

object(9) -> "add Obstacle" object(21).

In the action "Add Obstacle" I do not know how choose specific instances.

Is there any way to do this?xeed2013-09-06 09:08:41
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Sep 06, 2013 9:13 am

Your object(9) have to store the uid of object(21) in the variable.

So you can pick object(21) by uid using the variable. Then add to obstacle
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Sep 06, 2013 11:16 am

Could you show me an event sheet how you would set this up?

It does not matter if I pick object(9) or object(21), the problem is I can only add ALL instances as obstacles IN THE ACTION, rather than a specific one.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Sep 06, 2013 11:40 am

Oops. My bad. It will add all the same instances of the object as obstacle even if you push in 1 only. c4sp3r892013-09-06 11:44:19
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Sep 06, 2013 12:06 pm

Yes, currently the only way I see is to create a temporary Obstacle wherever needed, so only this one is accessed (and added) in the single action.

Any other ideas still welcome!
B
15
S
3
G
5
Posts: 396
Reputation: 4,977


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Waltuo and 33 guests