How do I Create this(cant describe) sry image inside

Get help using Construct 2

Post » Mon Nov 17, 2014 12:18 am

Hey i would need to create this dots. When you aim, the dots will show you where the arrow will probably fly.

Image
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Mon Nov 17, 2014 1:36 am

Time for a physics lesson! The path that the arrow will follow is going to be a system of two equations, which we'll derive. From some basic trigonometry(and intuitive thinking), we know that the system of equations describing the motion of an arrow without gravity is:

Code: Select all
x(t) = x0 - cos(a) * s * t
y(t) = y0 - sin(a) * s * t


Where x0 is the initial x position, y0 is the initial y position, s is the starting speed of the arrow, a is the angle the arrow makes with the X-axis, and t is the time -- in this case, in seconds. Since gravity is a factor as well, we need to take this into account as well. For an object that is merely falling from gravity, our equation for y is derived from acceleration due to gravity using calculus:

Code: Select all
ay(t) = g => ay'(t) = vy(t) = g * t => vy'(t) = y(t) = 0.5 * g * t^2

Where ay(t) is acceleration on the Y-axis, vy is the velocity on the Y-axis, g is acceleration due to gravity(a constant), and ' denotes a derivative of the preceding function identifier.

We can now add this to our initial system -- or rather, just y(t), since x(t) isn't affected by gravity -- to yield the system:

Code: Select all
x(t) = x0 - cos(a) * s * t
y(t) = y0 - sin(a) * s * t + 0.5 * g * t^2

You can now figure out the position of the arrow at any point in time, so you could use a for loop -- for example, from 1 to 10, dividing the index by 10 to yield a time range of 0.1 to 1 seconds -- and generate dots representing the future position of the arrow at certain points in time.

In your case, g will be your arrow's gravity in pixels per second, and s will be the predicted speed of the arrow -- based on how far back it's pulled -- in pixels per second.

This should give you everything you need to implement such a system. I'll post an example later, but if you get it figured out before then, go ahead and post it so others can benefit.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Mon Nov 17, 2014 1:40 am

lol :shock: :o

Thank you for your time linkman2004. I will never create something like this. I am graphics artist.
But will keep it safe in case i will understand it in future.

Thank you
Last edited by ex32 on Mon Nov 17, 2014 1:45 am, edited 1 time in total.
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Mon Nov 17, 2014 1:43 am

Anyways , if you are going to create an example, may you use this file plz? :D
You do not have the required permissions to view the files attached to this post.
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Mon Nov 17, 2014 3:00 am

Maybe you can find something useful here: viewtopic.php?t=77802&start=10
B
74
S
28
G
17
Posts: 256
Reputation: 15,125

Post » Mon Nov 17, 2014 3:33 am

^The link just above had some great code, taking into account C2 physics.

I put something together in a hurry in an attempt to help. It may just confuse you more and be needlessly complicated, but, drag the red dot, then release:

http://arrall.com/c2/motionmarkers

Something like that?

I looked at your capx. Nice what you've done with the bow, string, and arrow. The arrow travels rather fast with minimal drawing of the bow.
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 37
Reputation: 524

Post » Mon Nov 17, 2014 4:16 am

Thank you very much i will take a look,
And the bow and arrow it wouldnt be possible with help of the community here, If you liked it , try this.

https://dl.dropboxusercontent.com/u/84146142/WebGame11/index.html :D
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Fri Nov 13, 2015 5:58 pm

How to make the ball go super fast?
B
122
S
50
G
24
Posts: 401
Reputation: 22,462

Post » Wed Apr 05, 2017 1:15 am

I'd like my fish sprite to leap out of the "water" and then arc back into the "water"

at the moment most of the action is below the water line and I'm happy with the 8 direction control I have. If I swim to the surface I'd like to jump out at the angle and speed of exit and come back down at an arc.

Thought please

:D Alister from New Zealand
B
15
S
2
Posts: 2
Reputation: 750


Return to How do I....?

Who is online

Users browsing this forum: BackendFreak, kalibark2, Mohicano and 28 guests