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

0 favourites
  • 9 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hey i would need to create this dots. When you aim, the dots will show you where the arrow will probably fly.

  • 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:

    x(t) = x0 - cos(a) * s * t
    y(t) = y0 - sin(a) * s * t[/code:o2e19sw6]
    
    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:o2e19sw6]ay(t) = g => ay'(t) = vy(t) = g * t => vy'(t) = y(t) = 0.5 * g * t^2[/code:o2e19sw6]
    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:o2e19sw6]x(t) = x0 - cos(a) * s * t
    y(t) = y0 - sin(a) * s * t + 0.5 * g * t^2[/code:o2e19sw6]
    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.
  • lol

    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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Anyways , if you are going to create an example, may you use this file plz?

  • Maybe you can find something useful here:

  • ^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.

  • 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

  • How to make the ball go super fast?

  • 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

    Alister from New Zealand

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)