How do I Make my object go in direction of swing

0 favourites
  • 8 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Hello,

    So at the moment I have this game where its all about swinging around.

    I can swing 360 degrees around the object you click on, when you let go I want my character to fly off in the direction when you let go.

    Thanks in advance

  • Without knowing the behaviours and setup you use for player-movement and swinging around, it might be hard to answer this question..

    There must be something within your game you can get the current angle from on release and set the movement direction of the player to at that time..

  • This is how I'm making my character swing:

    On left button down, every tick.

    Character, Set position to (Object.x+cos(time*speed)*radius, (Object.y+sin(time*speed)*Radius)

    This works well for me, a part from the fact when i click on the object to make my character swing it puts him however far from the block due to my radius being a set number.

    Hope this helps

  • you could use the oldx, oldy method ..

    player is not swinging set angle to angle(oldx,oldy,player.x,player.y)

    every tick set oldx to player.x, set oldy to player.y

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "a part from the fact when i click on the object to make my character swing it puts him however far from the block due to my radius being a set number." If I understand this then part of your problem is finding the distance from the object clicked to the player and setting the radius to this distance? If this is the case all you need to do is

    radius = distance (object.x, object.Y, player.X, player.Y).

  • Thank you very much ram, that works perfectly.

  • Little stain this isnt working...

  • A bit more explanation other than it isn't working would be nice..

    What isn't working?

    What are the events and attached actions?

    What did you expect to happen and what does happen?

    Are there any conflicting events?

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