Man with a gun problem,

0 favourites
  • 5 posts
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • Hey, So I don't usually post as I can normally find what I need,,

    I've made a placeholder man, (just a rectangle) and I've attached an arm (Just a smaller rectangle), I've done the every tick set position blah blah, that works.. I've also told it to set the angle towards mouse.x mouse.y,.. everything works.. I just need to restrict the angle so my arm doesn't do a 360 all the way around... I have searched a fair bit but i'm probably missing it because i feel this would be a common thing?..

    Can somebody either direct me to a thread for this or rapid fire the answer below please..

    Thanks In Advance..


  • It's not exactly a degree thing, but for e.g. platformers this would work nicely

    You would need to make another condition to your set angle mouse event

    you could make an invisible object and add condition if NOT over invObeject > follow mouse

    or even better

    system > compare values

    first = Mouse.Y


    second = 400 (so only follow if not greater then Y 400)

    same for Mouse.X and you are done

    edit: changed some typo

  • Hi that's brilliant, The compare variables work, just so I can now tweak it to suit exactly what I need, what does the 400 represent? Like when my mouse is a certain distance away it doesn't follow, Is 400, 400pixels?

    Sorry quite new.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The X and Y coordinates start on the top left corner with 0,0

    So if your game is 1280px by 720px the right bottom corner would be 1280, 720

    If you want a mouse movement only occur on the top half you just take 360 (720/2).

    So the 400 only represent some random Y value I took - so the mouse only follows if the mouse is maximum 400 away from the top.

    To stop mouse movement if your cursor is off screen you can add another event like

    if smaller then windowWidht (or WindowHight depending if X or Y)

    and greater then 0

  • This is excellent! Thank you very much ,

    Help was much appreciated. Thanks

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