Contradiction in detection event + other problems

Get help using Construct 2

Post » Fri Apr 13, 2012 1:56 pm


Link here for pic

This is quite hard to explain so I have created a picture. Not sure if it will show up though since my preview button don't seem to work correctly. Keeps saying "there is nothing to preview".

Anyway can someone please help me on the following problems, Firstly on how to detect part of another object but at the same time not detect the whole thing. I just need to detect the edge of the wall. This is for the framework which I'm working on. To use click on the top right icon and a menu will appear then click on 1 and then the icon and the green square will become a tower. The towers can be rotated with the z key. Drag the tower to the wall and release to place tower there. This type of tower can only fire in 1 direction and can be only be placed next to a wall.

The current solution in the capx is the closest I have gotten, but its not what I need. The current solution works by dragging the icon into the wall then the tower appearing 1 square at the angle it is facing.
The base object stops certain problems too. This solution also still doesn't solve the problem of the towers appearing in the wall itself, not to mention the other problem is that it allows duplicates, Even if the tower exists it creates another one on the same spot.

Here the list of things I need it to do.

1. Detect the edge of a wall so that a tower can be placed there.
(top right picture)
2. Not detect the actual wall itself, no towers should be allowed to be placed there.
3. Not allowed to place towers in white squares. (where not next to a wall)
4. Not allow duplication if a tower already exists.

Phew, I think that is everything and I hope I have explained it well enough.

Here is the Capx Link
http://dl.dropbox.com/u/57137706/towerplace.capx
Here is the pic if it don't display.
http://dl.dropbox.com/u/57137706/final.png

Thanks for your time everyone.

Kind Regards
B
25
S
161
G
3
Posts: 51
Reputation: 18,702

Post » Sat Apr 14, 2012 8:56 am

Needs the behaviour plugins 'pathfinder' and 'turret' - is it possible to link these?

Would say from the outset you should set your origin/imagepoint on the blue squares to 0,0 (Top left) and check when overlapping, their x/y positions in relation to the black square.

You can then check reliably if the turret is overlapping the tower, and also make it snap to a grid.

I'd suggest using an invisible sprite that's set to mouse x/y and testing it if's overlapping the tower or a turret, that way you can prevent turrets embedded in the tower.




Are you using

Assuming you're using a grid
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Sat Apr 14, 2012 2:51 pm

Ah sorry, I was experimenting with the extensions, but they are not actually used in the project itself yet. I have now removed the behaviors from the capx but if you still need them I have included them in a zip file.

http://dl.dropbox.com/u/57137706/behaviors.zip
http://dl.dropbox.com/u/57137706/towerplace1.capx
B
25
S
161
G
3
Posts: 51
Reputation: 18,702

Post » Sat Apr 14, 2012 6:05 pm

B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Sat Apr 14, 2012 7:24 pm

Wow thanks again podpathos, that works perfectly and I learned how useful the new offset collision can be used.
B
25
S
161
G
3
Posts: 51
Reputation: 18,702

Post » Sat Apr 14, 2012 8:02 pm

Glad to have been of help. You gave me something to amuse myself. Keep on with your game.
B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Sat Apr 14, 2012 9:49 pm

Will do
B
25
S
161
G
3
Posts: 51
Reputation: 18,702


Return to How do I....?

Who is online

Users browsing this forum: GSquadron, Yahoo [Bot] and 26 guests