Make drag and drop object not pass through solids

Get help using Construct 2

Post » Sun Aug 18, 2013 10:45 am

My game is almost ready and I have just one more problem that I have been unable to solve myself. So maybe you guys can help me with this.

So I have this draggable ball that Im trying to make stay on my "playfield". I have solid walls around the playfield so other balls cant leave it but my draggable ball just ignores them for some reason. I have tried to make my ball solid, disable dragging on collison and on overlap but nothing works. I bet youll undestand this better if you see it for yourself.

https://dl.dropboxusercontent.com/u/32241884/Games/CAPX%20Files/dtbz.capx

I know the project is a little bit ugly but this is the first game Ive made with C2 so try to undestand :D
B
17
S
3
Posts: 26
Reputation: 1,518

Post » Sun Aug 18, 2013 10:53 am

I made a Klotski example a little while ago for someone else that dealt with this issue by forcing the object to be dropped as soon as it touched certain blocks. Here it is.GeometriX2013-08-18 10:53:29
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Sun Aug 18, 2013 11:06 am

The easiest way to restrict position of an object is to use the expression clamp.

example:
clamp(sprite.x,0,640)
clamp(sprite.y,0,480)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 18, 2013 11:11 am

Thatnk you GeometriX. That worked perfectly.
B
17
S
3
Posts: 26
Reputation: 1,518


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Euduardo, Jackriduk and 31 guests