Contradiction in detection event + other problems

0 favourites
  • 7 posts
From the Asset Store
Detects any kind of ad blocker. Very easy implementation into already existing projects
  • <img src="http://dl.dropbox.com/u/57137706/final.png" border="0">

    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

    dl.dropbox.com/u/57137706/towerplace.capx

    Here is the pic if it don't display.

    dl.dropbox.com/u/57137706/final.png

    Thanks for your time everyone.

    Kind Regards

  • 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

  • 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.

    dl.dropbox.com/u/57137706/behaviors.zip

    dl.dropbox.com/u/57137706/towerplace1.capx

  • Wow thanks again podpathos, that works perfectly and I learned how useful the new offset collision can be used.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to have been of help. You gave me something to amuse myself. Keep on with your game.

  • Will do

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