# Constant Force

Get help using Construct 2

### » Fri Jan 20, 2012 12:28 pm

never mind, i found it
i just made an event that checks if the x value is higher than point b, if not, chnage the velocity to -100
works like a charm.
B
10
S
1
Posts: 39
Reputation: 1,053

### » Fri Jan 20, 2012 12:54 pm

nope, that didnt work lol. take look and see what i mean.
http://www.mediafire.com/?5kyrp4bl7e2c7qt

when i make a line from right to left, as soon as my mouse passes a certain point, the belt switches into -100
B
10
S
1
Posts: 39
Reputation: 1,053

### » Fri Jan 20, 2012 1:37 pm

you can use a positive number for all your conveyor belt and for the direction you can do something like:
[code](cos(conveyor.angle)=0) ? 0 : conveyor.velocity*abs(cos(conveyor.angle))/cos(conveyor.angle)[/code]

in short, if the angle of the conveyor belt is within ]-90;90[ this formula will returns conveyor.velocity
if the angle of the conveyor belt is within ]90;270[ this formula will returns -conveyor.velocity
if the angle equal 90 or -90 it returns 0Yann2012-01-20 13:38:55
B
61
S
22
G
14
Posts: 1,480
Reputation: 16,373

### » Fri Jan 20, 2012 2:15 pm

worked like a charm =]. thankyou. as you said i used the angle to determine which way it should face and works with no trouble.
one last thing i had a bit of trouble with,
when i create one belt object, how do i set it so the 1st bar deletes when i create a second, so only 1 is on screen at a time
B
10
S
1
Posts: 39
Reputation: 1,053

### » Fri Jan 20, 2012 2:24 pm

[code]Global variable current=-1
+Mouse: on left click release
+conveyor: pick by UID current
->conveyor: destroy
+conveyor: is Selected
->Sytem: set current to conveyor.UID[/code]
Taking into account that you have a 'selected' boolean or something that carry the meaning of "this is the conveyor belt I was just manipulating" that you will switch to false when you drop the belt.Yann2012-01-20 14:24:20
B
61
S
22
G
14
Posts: 1,480
Reputation: 16,373

### » Fri Jan 20, 2012 2:46 pm

ok youve got me, im trying to underetsnad what your saying but just dont get it.. i cant seem to give the 1st conveyor a unuiqe id of say 1,
then when i make 2... delete 1...make 2 into 1

i just cant seem to make it functional in the events
B
10
S
1
Posts: 39
Reputation: 1,053

### » Fri Jan 20, 2012 3:36 pm

Objects have a Unique ID by default in C2.
You just need to "reference it".

Read this topic about picking instances with the UID and yet again this topic about picking in general (very informative).

This is quite a big piece I admit, but once you get it and begin to apply it in C2 it makes a lot of things easier.

New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
253
S
86
G
42
Posts: 7,037
Reputation: 59,189

### » Fri Jan 20, 2012 4:00 pm

thanks for the reply, ive had a good read but im still confused by this. lol. i try to set it so it deletes instance 1 if 2 are on screen but that just deletes all the conveyors i have instantly
B
10
S
1
Posts: 39
Reputation: 1,053

Previous