wretchedshark's Recent Forum Activity

  • there might be a way "around" it using distance. set a range instance variable for your ai cars and then compare -> range is greater than distance(player.x, player.y, ai.x, ai.y) (so within range) and then add which action you want steer towards or rotate towards player.x player.y

    the only problem with this is that if they are ahead of the player they would turn backwards towards them.

    you might encounter the same problem if it's a top down (as i found out trying to make a ragdoll that could walk using the sprite's .angle) is that the angle is dependant upon it's position. that is to say a leg piece might be at 45 degrees relative to its joint but it's sprite angle is say 90 or greater due to the whole thing having tipped forward. so your ai car may be at 45 degrees to the player car going up the track but 225 degrees coming down the other side.

  • Have you tried putting the healthbar on a separate layer and set that layer's parallax to 0,0 ?

  • Thank you again! I am learning a lot from this, going to add more enemies and players using your event system :)

  • Is this what you're trying to do?

    dropbox.com/s/qdqnsb691rowvey/shieldbar.capx

    You may also be able to use local variables for the shield sprite itself, i'm not sure which is more correct but hopefully this helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am a noob too so this may be incorrect. My idea would be to create a graphic of all five hearts together and have an animation (just one frame) of each that would display so animation "Zero" would be all grey hearts, then "One Heart" would be the animation with one heart there and so on.

    Then in your events make a simple event to set your heart HUD to the correct animation based on how many hearts (your global heart counting variable, either the large or the small heart, i am not certain) the character currently has.

    System compare variable if numberofhearts = 0

    - set animation to "Zero"

    If this is not what you're looking for the other advice I can offer is create a text object on your HUD layer and every tick set the text to display your variables (say set text to "Hearts: " & yourheartvariable) - this is for easier debugging while testing your game.

  • Thank you! I really appreciate this, it's hard to know and learn how to create these conditions properly and without creating a whole bunch of extra work (like overlap instead of comparing range).

    I do have two questions if you don't mind:

    1) How would I go about re-implementing the feature where one player can only attack one enemy unit at a time? In my capx the only way I could get it to work was by adding the pick closest enemyunit to hitsensor. As you noted this reiterates construct already picking an enemyunit, but if two enemy units overlap the hitsensor they do both take damage. (Event 33 in your capx)

    If the player spawn is set to only one unit and you spawn two enemy units the player can hit both of them at the same time.

    2) Event 34 (every X seconds -> destroy hitsensor) Is there a better way to destroy the stray hitsensors? Or does your event system for attacking prevent this? With mine sometimes the enemy would die just before the hitsensor spawned leaving an extra hitsensor on the layout. This is just in case in future testing.

    Thank you again for your time!

  • It should stop both of them, it's a prototype for setting up a side-view base defense game, so to get to the other base I wanted both sides to go through (kill) one another before proceeding.

    Also I forgot to mention that the way the current health subtraction is set up is supposed to pick the nearest enemy to the hitbox and subtract that enemies health, so if it's 2 vs. 1 - the single unit won't be able to fend off both at the same time.

  • I do, that is what baffles me. Why the stacked animation causes the problem. 1 vs 1 works, 2 vs 1 when the attack animations are on different frames also works, but if they end up attacking on the same frame then the health of the enemy drops by a large portion.

    Here is the code for health subtraction if that helps without looking at the capx.

    <img src="http://i702.photobucket.com/albums/ww22/fishtank36/c2events.jpg" border="0" />

  • Thought I had this solved by adding in hit sensors, been stumped for the past few days.

    Problem: When two player units attack an enemy unit the enemy unit's health drops by 13-17 points when it's only supposed to drop by 2 (one for each player hit).

    If their animations are staggered the health subtraction works perfectly.

    Here is my capx:

    dropbox.com/s/dzzdlsloa6ibqna/basedef.capx

    I have it set to spawn two player units with one click of the buy button to simulate when they get stacked up after defeating an enemy unit together, hopefully someone can help!

    (Mouse over the enemy unit to see it's health)

  • still working on the second part but the disable collisions was just what i was looking for, thank you for the help!

  • any ideas?

wretchedshark's avatar

wretchedshark

Member since 23 Nov, 2012

None one is following wretchedshark yet!

Connect with wretchedshark

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies