0 Favourites

Rotate hand with a gun toward an angle (control)

  • Hello, Guys

    I want to control a hand's sprite with W (up toward 90 degrees) and S (down toward -90 degrees). I got a difficulty with

    2 aspects.

    1) When the sprite is turned left his hand is not mirrored correctly.

    2) When the sprite is turned left , W and S control is now working upwards.

    Here are my events

  • First of, the else condition for the S control seems unnecessary.

    Both problems can be fixed with the flipped action. Only use this action on your gun sprite, otherwise your player will flip upside down too.

    Hope it helped! Goodluck!

  • Unfortunately, it did not work.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You'll still need the mirror action on your gun aswell. So like this:

    Event:

    On Right arrow pressed

    Action:

    player Set Not mirrored

    gun Set Not mirrored

    gun Set Not flipped

    Event:

    On Left arrow pressed

    Action:

    player Set mirrored

    gun Set mirrored

    gun Set flipped

    I think it should work like that

  • This is what I got..

  • I am guessing that I should work more with events 30-32 to make it work.

  • It's all a guessing game from here, why don't you share the capx?

  • It's all a guessing game from here, why don't you share the capx?

    Sure, here you go

    Ups.. I do not have enough rep to post urls here...

  • heliogame

    Dude, there it is.

    Enjoy !

    Demo

    Capx

  • heliogame

    Dude, there it is.

    Enjoy !

    Thank youuuuuuuuuuuuuuu!!!!

    Almost done! How would you solve the issue when you raise the arm (W) up to the limits and then when you move it down (S) , it is moving on the other side of the player?

    But thanks again, c2 is not so easy as i thought.

  • [quote:1dhamwxz] How would you solve the issue when you raise the arm (W) up to the limits and then when you move it down (S) , it is moving on the other side of the player?

    Yup, it happened because, the limit point are too much (more than 360 degrees)

    I fixed it by offset the limit point for both top and bottom, by plus 5px from the X origin point of the Dude.

    I have updated the Capx file and the Demo so, check it out.

  • [quote:1vqcfjub] How would you solve the issue when you raise the arm (W) up to the limits and then when you move it down (S) , it is moving on the other side of the player?

    Yup, it happened because, the limit point are too much (more than 360 degrees)

    I fixed it by offset the limit point for both top and bottom, by plus 5px from the X origin point of the Dude.

    I have updated the so, check it out.

    You are genius, Sir! Solved!.

  • [quote:17g97r4x]You are genius, Sir! Solved!.

    heliogame Your welcome, there's a bug if we are shooting at the top limit angle.

    From all of this I think you will get the idea of how to apply it and fine tune those number to fit your game.

    But if you still need help just tag me.

  • [quote:2gifubnp]You are genius, Sir! Solved!.

    heliogame Your welcome, there's a bug if we are shooting at the top limit angle.

    From all of this I think you will get the idea of how to apply it and fine tune those number to fit your game.

    But if you still need help just tag me.

    newlee, sorry to bother you again, I got 2 problems that i really cannot resolve.

    1. I cannot fix the bug when we are shooting to the right side of the player (a,d) at the top limit angle or at bottom limit angle. The gun cannot set at the real top limit or real bottom limit.

    2. Oh, I am stuck again with this shooting left , the bullet shoots always right. I know how deal with it when I know an actual angle of the gun, but this is not the case of the fixed angle.

    I attached the sample capx of my problem .

  • Shooting left illustration

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