TRMG's Forum Posts

  • Hi everyone!

    In my game I need to know if an enemy tank can hit the player if they were to fire at a specific angle.

    I've done it so far by using a clone of the normal bullet (the purple bullet in the pictures), setting it's speed really high and checking if it collided with the player.

    My problem is that because the game is turn based and these bullets take a few 1/10 second to finish, the game feels sluggish to play.

    I thought of using sprites that would curve along the path of the bullet to test collisions, but these sprites would need to be really long and since the enemies can move on walls and ceilings (making the trajectory of the bullet slightly different) I would need a lot of them, so it's not really an option...

    So, do you guys know of a way to check if the bullet would hit something that is fast enough so that it doesn't feel sluggish?

    Thanks!

    Also, if you're interested in the game, you can download the wip version here: https://www.dropbox.com/s/82j3k66qfopqh ... 1.zip?dl=0

    Let me know what you think!

  • dop2000 Thank you very much! Looks like the "Every X seconds" event was the problem.

    I guess the events in the loop would terminate when it would move on to the next index, thus not triggering anymore the "every x seconds" event.

  • Hey guys, I'm trying to set an instance variable called "FallSeconds" on each instance of an object based on it's velocity at it's angle.

    Img:

    I am using this formula to calculate the velocity at an angle: cos(ANGLE)*OBJECT.physics.velocityX + sin(ANGLE)*OBJECT.physics.velocityY (Thanks to R0J0hound for the formula)

    Then if it's >50, every 0.1 sec I add 0.1 to the "FallSeconds" var of that specific object

    If it's <50 I set it once to 0.

    (I need the FallSeconds var to check if the object fell too much and destroy it)

    My problem is that instead of checking for each object's velocity and adding only to that object's variable, it picks only one object to check the velocity and sets all other object's variable according to that velocity. (i checked this with the "cursor is over object" event)

    I have tried adding a "Pick all OBJECT" event, as well as leaving it empty, but it had no effect, and when I added a "For Each OBJECT" event, it would only work on 1 object and the others would not change...

    So, do you guys know what I'm doing wrong?

  • dop2000 Hey, that method worked great.

    Thanks for your help.

  • dop2000

    That wouldn't work either in a situation like this:

    The egg could also hit the ground object from the right or left.

    I also can't hard-code an angle to check against for each ground object because the egg could hit the ground from multiple angles...

    I saw another forum post where someone else found a way to do this by attaching some small sprites around the object and checking if they overlap with another object. If they did, then I could use their position for a rough estimate for where the collision took place.

    I'll try this method and see if it works in my case too.

  • [...]why can't you compare egg's velocity at the moment of collision?[...]

    You mean the overall velocity?

    Well if the egg were to move really fast towards the right and only slightly downward and it would hit the ground (that is underneath the egg), it would still break.

    I want it to break only if it's velocity at the angle of the collision is too high.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey there, I've got an egg (with physics) in my game and I want it to crack when it hits the floor to fast.

    Img:

    I can use this formula to calculate the velocity at a certain angle: cos(ANGLE)*Egg.physics.velocityX + sin(ANGLE)*Egg.physics.velocityY

    but I don't know how to get the collision point so that I can convert it into an angle and then compare it...

    Do you guys know how to do this?

    Thanks!

  • [...]iOS also is not very friendly towards new games that don't have a lot of demand.[...]

    Is that so?

    I was thinking of buying a licence for the Apple store; do you think it's worth it for releasing smaller games?

  • totoe Oh sorry, I tried the dropbox link before the google drive one and since it didn't work I thought the google one wouldn't either...

  • Hi Animmaniac, could you re-upload the effect?

    I really wanted to make a water physics game and this seems to be the best way to do it.

  • luckyrawatlucky Yea I was trying to use only one object for this since it would be a cleaner way, but it seems like it can't be done I'll do it with multiple objects.

    Thank you both for the help.

  • Bump...

  • [...] If you make attack animation to only move one hand with a weapon, and shield animation to only move another hand with the shield, then you may be able to play both simultaneously. [...]

    I've have tried that and it didn't work. Seems like even if they don't share the same bones, the animation still get fully replaced by the new one.

    But thank you all the same

  • dop2000 Hi, I am using character maps, but I don't think that they'll help in this situation...

    Let me try to explain what I am trying to do better:

    I have these two animations (Videos):

    Right Hand Attack: https://www.dropbox.com/s/tge0z6reeuq5k ... k.mp4?dl=0

    Left Hand Shield: https://www.dropbox.com/s/vy7dg6k9v649l ... d.mp4?dl=0

    And I want the player to be able to attack (when pressing the space bar) or shield (when pressing shift), even if the other animation is playing. So if he is shielding and he presses space, I want him to continue to shield and at the same time play the attack animation.

  • can post a .capx add-on free?

    The pluggin is needed for importing spriter animations into C2...

    Can you download it from here?