Create a mouse jitter

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi, I want to create a jitter in the mouse position for a shooting game I'm making, just to make it a little tougher. I know it'd be a simple case of setting the mouse X and Y coordinates to a small random change but I can't find a way to do this in events and actions.

    I've added a MOUSE object but the only option I've got in the ACTION section of EVERY TICK is to set the mouse cursor style, not the position as I'd like.

    Can anyone point me in the right direction?

    Thanks.

  • I would just make the cursor invisible, and use a sprite set position to the mouse x,y. For the jitter set the sprite position to mouse + random(-10,10).

    You'll probably want to use a variable, like if variable = this set position, variable = that set position + random.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had my mother come round while the reply was open haha - what the post above this says.

    I made a quick example, I'll upload later, you can set a random offset to the mouse to point the bullet in

    spawn bullet

    set angle of motion angle(bullet.x,bullet.y,cursor.x,cursor.y) and random numbers to cusror coordinates.

  • I was curious to experiment with this - as I may use something similar for an enemy turret behaviour in a platformer I'm working on.

    Ignore the shoddy graphics, just whipped up some placeholder - you get the idea :

    Sine Shooter

    The method employed in the example is to attach a sine-movement (angle) controlled sprite attached to the cross-hair/mouse position with the magnitude increasing in proportion to the distance the cross-hair is away from the ship.

    Download here : SineShooter.capx

  • Nice Project there Johnny. It sort of adds an extra it of detail to the game. Leaving the bullets shooting straight makes the game look a bit... constructed? While having it a bit waving just helps the game flow. Good job! <img src="smileys/smiley4.gif" border="0" align="middle" />

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