How do I exactly stop the bullet at position ?

Get help using Construct 2

Post » Mon Jun 15, 2015 7:52 pm

hi all,
i just want to stop bullet of a sprite at exact position (x or y)
i use if sprite.X < 80 set bullet desable or sprite.x > 80 set x to sprite.-5*60*dt
but always it stop at different X
see .capx https://www.dropbox.com/s/o4dn71frsdheu ... .capx?dl=0
thanks for help
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Mon Jun 15, 2015 8:14 pm

You might want to take a look at rexrainbow's MoveTo plugin. You can use it to move a bullet an exact distance, at an angle and speed, or to a point in space. His PushOutSolid plugin can be used if you want the bullet to stop precisely at a solid wall
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Wed Jun 24, 2015 12:13 am

@7soul
that's ok it work for moving object
but if for example i want to set an image with this (if with of sprite < 400 then set sprite.width to self.widht-10*60*dt)
it always stop at different with and not exactly to 400
any suggest ?
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 24, 2015 12:27 am

Use max() and it will stop exactly at 400.
Code: Select all
+-------------------+
| sprite: width<400 | sprite: set width to max(400, self.width-10*60*dt)
+-------------------+


If the value is increasing instead you can use min().
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Wed Jun 24, 2015 1:45 am

thanks a lot really appreciate it
and then i can also use it for if x < 400 (for example) without use the moveto rex plugin ?
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 24, 2015 2:49 am

For that simple case, yes.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Wed Jun 24, 2015 5:15 pm

R0J0hound wrote:Use max() and it will stop exactly at 400.
Code: Select all
+-------------------+
| sprite: width<400 | sprite: set width to max(400, self.width-10*60*dt)
+-------------------+


If the value is increasing instead you can use min().


its stranger .... it set directly width to 400 (without the gradiant effect)
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 24, 2015 8:32 pm

looking at it again you'll probably want width>400 since by subtracting from the width it should be shrinking.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Wed Jun 24, 2015 8:48 pm

i just would like that for example the object sprite looks small and grow to 400 for 3 or 4 seconds
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Thu Jun 25, 2015 10:55 pm

R0J0hound wrote:looking at it again you'll probably want width>400 since by subtracting from the width it should be shrinking.

here is what i want exactly
but as i told you always stop at different value
https://www.dropbox.com/s/vrc769cjw12pm ... .capx?dl=0
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie, Yahoo [Bot] and 19 guests