How do I make a mouse that will collide with objects?

0 favourites
  • 5 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I'm trying to make a game similar to Cursors.io and to do that I need to make the cursor collide with walls. I currently have the default mouse set to invisible and I made a separate mouse object to collide with stuff. Both the mouse and wall objects have the "solid" behavior. but when I test it, the mouse passes right through the wall. Does anyone know how to solve this?

    (The picture below is of the programming in the early stages, not anywhere near finished.)

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solid behavior doesn't prevent collisions between solid objects. It's supposed to be used with other behaviors like 8direction, Bullet, Platform, Car etc.

    So you need to add one of those behaviors to the cursor sprite and move it with the behavior towards mouse position. I suggest using behavior actions for movement, for example "Set vector", because if you set sprite x/y coordinated directly, collisions with solids may not work properly.

    I would try Bullet first - On every tick set bullet angle of motion to angle(self.x, self.y, Mouse.x, Mouse.y)

    .

    Another approach is Physics. Check this demo:

    howtoconstructdemos.com/physics-ball-attracted-to-mouse-cursor-capx

  • I tried both of these approaches in detail but they didn't end up working. SDo you have any other suggestions?

  • Give the cursor the MoveTo behavior and enable "stop on solids"

  • I tried both of these approaches in detail but they didn't end up working. SDo you have any other suggestions?

    Maybe you didn't code it correctly, if you can post another screenshot. I'm no expert but user dop2000 is.

    I made a game once where you could catch things. Now the basket I used to catch things was moveable with your cursor/touch. But when I moved the basket really fast, the falling things would go right through the basket because the engine couldn't 'calculate' it fast enough or something. Perhaps something similar is going on with your project; not sure if it's possible, but you could slow down the movement of the cursor a bit. I don't know how it's done though, but again, dop2000 might know!

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