how can i set turret position in this example

0 favourites
  • 4 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • hi

    please see this capx

    dropbox.com/s/qg05u1sw8ydic5i/prob.capx?dl=0

    i have 72 frame of a tank rotating

    i want my turret position always be in the back of the tank but i can not use imagepoints as you can see (it is so bad when i use imgepoints and turrets not always in the same place ) that must be so acurate to work and doing that for 72 frames and alot of objcts like that is not an option

    so i need a formula

    please help .. !

  • no one know that ?!?!?!?!?!?

    my project almost done i just stuck with this !

    any suggestion?!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if i know how to move an object in a isometric circle then i can solve that !

    any one can help ?

  • With the truck facing right the offset of the turret to the truck is (-13,-8).

    Then you can set the position with

    turret.x = truck.x -13*cos(360/72*truck.animationFrame)

    turret.y = truck.y -8 -13*ratio*sin(360/72*truck.animationFrame)

    Now "ratio" is the ratio from the visual height to the visual width of a isometric square. Depending on the angle of the isometric projection the ratio will be different. I was expecting 0.5, which is 26.5 for degree, but that didn't look right. So I measured the roof of the truck at 0 and 90 degrees. It was 8 pixels wide at 0 degrees and 22 pixels at 90, so the ratio is 8/22 or 0.36, so the angle is 20 degrees.

    So you could write it like this:

    turret.x = truck.x -13*cos(360/72*truck.animationFrame)

    turret.y = truck.y -8 -13*tan(20)*sin(360/72*truck.animationFrame)

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