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

Get help using Construct 2

Post » Tue Apr 05, 2016 5:35 am

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
B
12
S
6
G
3
Posts: 19
Reputation: 2,598

Post » Tue Apr 05, 2016 7:07 am

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
B
81
S
21
G
23
Posts: 515
Reputation: 18,702

Post » Wed Apr 06, 2016 5:28 am

Cipriux wrote:https://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?
B
12
S
6
G
3
Posts: 19
Reputation: 2,598

Post » Wed Apr 06, 2016 1:12 pm

@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
B
81
S
21
G
23
Posts: 515
Reputation: 18,702

Post » Wed Apr 06, 2016 4:53 pm

Thanks again!
B
12
S
6
G
3
Posts: 19
Reputation: 2,598


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, volumetv and 18 guests