Trajectory of an arrow

Discussion and feedback on Construct 2

Post » Mon Oct 31, 2016 9:57 am

Hey guys!

I am working on an archery game and I would like if I could draw a dotted line that would follow the arrow that I would launch.
Something like this:
Image
For the arrow I am using the bullet behaviour with gravity.

Do you know any way I could achieve this?
Thanks in advance!
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Mon Oct 31, 2016 10:29 am

You could use a dot sprite and spawn an instance of it at the arrow's location (be it origin or image point) every X frames/seconds/etc. Then give it a timer to destroy it, or destroy it at a certain event (depending, if you want it to disappear after some time, or when something else happens).

There might be a better way, though. This one is just off the top of my head.
B
8
S
2
G
3
Posts: 18
Reputation: 2,036

Post » Mon Oct 31, 2016 11:04 am

dastmo wrote:You could use a dot sprite and spawn an instance of it at the arrow's location (be it origin or image point) every X frames/seconds/etc. Then give it a timer to destroy it, or destroy it at a certain event (depending, if you want it to disappear after some time, or when something else happens).

There might be a better way, though. This one is just off the top of my head.

I want the dotted line to appear before you would launch the arrow...

I could have a second arrow witch would be invisible and every time you would change the trajectory it would launch it, but I am afraid of performance drops on mobile...
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Mon Oct 31, 2016 2:45 pm

calculate-curve-between-two-points_t85302

Search tool is your friend ;D
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Mon Oct 31, 2016 4:04 pm

@TRMG

I made an example a year or two ago for someone asking a similar question. I ended up making an angry birds type game.
There was a thread last month where someone else was playing with it:

https://www.scirra.com/forum/viewtopic.php?t=182292&p=1070325#p1070325

or see my original capx files:

http://www.rieperts.com/games/forum/angry_birds.capx

or a better version (but requires ROJOhounds chipmunk physics plugin)

http://www.rieperts.com/games/forum/angry_birds_chipmunk.capx

The chipmunk version leaves a trail of dots after each shot - so you know where you aimed previous times. And the chipmunk version preforms better on mobile.
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Mon Oct 31, 2016 7:15 pm

Tokinsom wrote:https://www.scirra.com/forum/calculate-curve-between-two-points_t85302

Search tool is your friend ;D

AllanR wrote:@TRMG

I made an example a year or two ago for someone asking a similar question. I ended up making an angry birds type game.
There was a thread last month where someone else was playing with it:

https://www.scirra.com/forum/viewtopic.php?t=182292&p=1070325#p1070325

or see my original capx files:

http://www.rieperts.com/games/forum/angry_birds.capx

or a better version (but requires ROJOhounds chipmunk physics plugin)

http://www.rieperts.com/games/forum/angry_birds_chipmunk.capx

The chipmunk version leaves a trail of dots after each shot - so you know where you aimed previous times. And the chipmunk version preforms better on mobile.

Awesome, thank you!
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602


Return to Construct 2 General

Who is online

Users browsing this forum: didakcode, Tjums and 9 guests