How do I Make a wall, my cursor cant pass

Get help using Construct 2

Post » Sat Dec 13, 2014 10:18 pm

I dont know how to use Mouse-lock, as i started with construct a few days ago, im not familiar with the plugins, though i have it installed, im not aware how and what it does..

Developing for chrome, Not Ie, that was just the only solution i could think of after a couple of hours of thinking...
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 1:12 am

Anyone?
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 2:01 am

Well, if you download v0.3 of mouse lock, there is a capx included that might be of some help. Also some documentation.

The best thing would be to simply post your capx; otherwise, we're kind of taking shots in the dark here.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Sun Dec 14, 2014 2:45 am

Here, if you move fast enough the cursor clips right through.. it was made in Version R173, because my internet will probably break if i try to update it (i have working cursor lock v0.3)
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 6:28 am

Can i bump?
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 7:22 am

How about attach a custom cursor sprite pinned to the mouse movement, and have that get stopped by walls. Then the player has to reaquire the cursor?
B
5
Posts: 17
Reputation: 259

Post » Sun Dec 14, 2014 7:53 am

you cant directly pin to the mouse movement, and w/o setting the position directly to the mouse, you cant get a very responsive cursor...
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 7:41 pm

it seems like theres no solution...
B
5
Posts: 15
Reputation: 259

Post » Sun Dec 14, 2014 8:42 pm

To stop the cursor from clipping through walls you need to use a loop to check all positions between the old mouse position to the new position for a collision.
like this or the attached capx:

repeat distance(cursor.x, cursor.y, mouse.x, mouse.y) times
---- cursor: move 1 pixel at angle angle(cursor.x, cursor.y, mouse.x, mouse.y)
-------- system: pick wall overlapping cursor.x, cursor.y
-------------- cursor: move -1 pixel at angle angle(cursor.x, cursor.y, mouse.x, mouse.y)
-------------- stop loop


There are other ways such as doing a raycast from the old mouse position to a new one but c2 has nothing built-in for that. You could also do wall sliding for a more pleasing motion instead of getting stuck on walls, but again there's nothing built in to handle that.
You do not have the required permissions to view the files attached to this post.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Sun Dec 14, 2014 10:15 pm

Your a life saver, cant thank you enough!!
B
5
Posts: 15
Reputation: 259

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Armench, Artcadev, farsen, Google [Bot] and 12 guests