MessMess's Recent Forum Activity

  • Thank you so much for your excellent suggestion. I'm sure that would work and it actually gave me some ideas for how I could solve some other upcoming issues.

    I've been trying to find a solution for the past hour and just came up with this solution below (I just had to add an Instance Variable on Bullet called "Live" by default set to False).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm working on a tower defense game and it has an object "Bullet" that is fired from a turret object "Tower".

    I want to destroy the Bullet if it collides with another Tower (instead of the enemy).

    So, I wrote this:

    Bullet On Collision with Tower -> Bullet Destroy

    But, since the Bullet is being created on top of a Tower, it is destroying the Bullet before it can even move away from the tower that created it.

    Is there a simple way to prevent this from happening?

    Thanks in advance,

    Chris

    p.s. In my game, these bullets bounce, so it's possible the bullet would hit the original tower and that should destroy it as well (just not as soon as it appears).

  • You do not have permission to view this post

  • I just played your game and it was a lot of fun!

    It looks great too - one of the best I've seen done in C3 (excellent work on the UI elements too)!

  • "System -> Pick overlapping point" works great.

    Thanks so much!

  • I have objects called "Obstacle" that are all over my layout and I need to be able to check certain coordinates to see if they are in that specific location.

    I know the X and Y coordinates I need to check, but I don't know how to do the test.

    In pseudocode it would be this:

    If Obstacle exists at position Layout.X , Layout.Y Then ...

    Else ...

    Any help would be much appreciated.

    Tagged:

  • Played your game and it was really fun. Loved the bee animations!

  • The reason you are having the problem is because it creates the object on a click, then immediately runs the next event which is to rotate on click. A better fix would be to lock out the rotate event on towers that were recently created, perhaps with a 'state' variable. When you release mouse click you can set the variable to allow the tower to be rotated.

    lionzThis seems like great advice.

    Is a "state" variable the same a global variable?

    Also, where in the order would the release mouse click code go?

  • Like this:

    That did it!

    You made my day. Thank you so much.

    Edited: Just wanted to add, thank you for teaching me about families and sub-events. I think I understand both concepts now and I was able to use that new knowledge to enhance and streamline my code. Very cool!

  • Really appreciate your patience (I'm used to more traditional programming and I guess I haven't fully grasped events yet).

    Anyway, I think I added the check for the ObjectTypeName correctly (see image):

    But, where the heck does the Else go? I can't even find an else statement in the events sheet.

  • I feel very dumb and I'm not sure what I'm doing wrong now.

    I made the change you suggested and now it is only rotating that one tower called "Turn", but it's back to also calling the code on the left click below it.

    Here is the relevant code bock:

    Here is an image from the game:

    So, what should happen is:

    - If you left click on an "Obstacle" object (which is not in the Families, "Towers") it will add a new "Turn" object. This currently works.

    - If you left click on a "Turn" object (which is in the Families, "Towers") it will rotate the turn. This works now too. But, it's also creating another instance of the "Turn" object.

    I need clicking on the "Turn" Object to only kick off that code, even though the "Obstacle" object is right underneath it.

    Thanks for any guidance.

  • Families seems like the best solution, but I must be doing something wrong.

    I created a family called towers and put all my tower objects into it.

    This is my event:

    But now, when I click on it, every instance of "Turn" is rotating, not just the one I clicked on.

    Any idea, what I am doing wrong?

MessMess's avatar

MessMess

Member since 22 Nov, 2023

Twitter
MessMess has 1 followers

Trophy Case

  • 1-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Quick Draw First 5 people to up-vote a new Construct 3 release
  • Email Verified

Progress

6/44
How to earn trophies