Movement weird when scrolling

0 favourites
  • 6 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I want to control a character with WASD and when you press the sword, you aim and slash with your mouse. Everything worked until I added a scrolling function and my sword aiming just went bonkers.

    So, basically when you press the sword the arrow should always point to the mouse cursor. Because of the scrolling, it doesn't behave like that and I can't figure out why that is.

    Anyone have a clue to what's going on here?

    dl.dropbox.com/u/4898391/zig_03.capx

    Thanks:)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had a look and didnt really see what you meant, the sword attack seems to work ok for me. One thing i noticed though was that your sword (the sword you click to unsheath and then you have the ability to attack) needs to be on a UI layer (so it doesnt move when the scroll screens and instead is on the screen wherever the player walks).

    How to make a UI layer is covered in the early tutes.

  • Heh yeah sorry. I'm a bit loopy after beating at it all day.

    So, when you "unsheathe", I want the arrow to always point to the mouse pointer. As if the character is strafing around the mouse pointer. It works great when the screen scrolling is not there.

    Thanks for the GUI tip, been trying to figure out how to do that :)

  • Ahh i see what you mean now, no worries.

    In the part where you set your arrow :

    it needs to be "angle(player.X,player.Y,mouse.X,mouse.Y)"

    instead of "angle(player.X,player.Y,mouse.AbsoluteX,mouse.AbsoluteY)"

  • Oh scheisse! :)

    Thanks man!

  • Haha, no worries :)

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