Mouse goes to margin...sprite can't have collisions,now what

0 favourites
  • 5 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
  • I am having an issue with using the mouse input. I have included a capx so it can be easily understood. I have also set the mouse to crosshairs so you can see what I am exactly talking about.

    The sprite which you are moving with the mouse can be taken to the right or left. The mouse (crosshairs at this point) will be in the margin thus making the sprite not able to be collided by the other falling sprites. Thus negating the whole collide with another object if you can easily sit at the right when the game gets harder.

    I have tried putting the margins to 0,0. Didn't work.

    I have made it where (if sprite is off screen/layout it will be destroyed). Works kind of, but you can still sit at the right or left and still avoid a collision.

    Just not sure what to do. If I upload it to the arcade will it be fine? Is it just because I am previewing it and the margins are just screwing it all up?

    Just play the capx and wait 5 seconds or so and sit at the left/right with the mouse all the way off the screen and it will do what I am saying. Thanks!

    https://www.dropbox.com/s/xfs37gw43oue48j/Avoider%20Test%20Game.capx?dl=0

  • https://dl.dropboxusercontent.com/u/139 ... priux.capx

    I removed the Bound to layout behavior and set a clamp to Player position so is always inside the layout.

    I think the problem is the "Bound to layout" behavior in combination with Player position = Mouse position

    I believe that the Player is actually outside of layout durring the collision check, but the display is updated afterwords

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dl.dropboxusercontent.com/u/139926126/Forums/scirra/Avoider%20Test%20Game_Cipriux.capx

    I removed the Bound to layout behavior and set a clamp to Player position so is always inside the layout.

    I think the problem is the "Bound to layout" behavior in combination with Player position = Mouse position

    I believe that the Player is actually outside of layout durring the collision check, but the display is updated afterwords

    Thanks Cipriux! Completely forgot about having the Bound to Layout behavior on. I took what you added to the capx and added it to the game and it worked perfectly. Also liked the Flash too. Simple thing to let the user and me know that you obviously got hit.

    What is it called when you add the viewport, player, clamp etc. to the X and Y coordinates? That still seems a bit tricky to me. What would I search for if I wanted to learn about those things in the Construct 2 Manual?

  • packer43064 You can read about System expressions here: https://www.scirra.com/manual/126/system-expressions. You cand also find the clamp() that I used.

    In your example , you can make a more simple expression like Player.X = clamp(Mouse.X,0,1000) and you can see the ideea.

    So , in C2 you have conditions, actions and expressions

  • Thanks again!

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