ManoD's Recent Forum Activity

  • I may be overthinking it but when two objects overlap there isn't typically a single contact point but an overlapping area. If the collision shapes are convex there may even be multiple areas. A way to find those areas would be to take the collision polygons and applying some clipping algorithm to that, but that's not very trivial to do.

    As a second phase you could then find the midpoint of those areas to give you a single point.

    Alternately you could utilize an algorithm called the Separating Axis Theorem (SAT) to push the objects apart to just be touching and find that point. If the shapes are concave then it would be more complex to handle. This is also a bit involved to make.

    Another idea is to utilize something like a raycast. Check the points from the hilt to the tip of the blade to see if any collide. As soon as one does, stop checking more and use that point. You could use the condition "pick object overlapping point" to do the point collision checks, or you could use a small detector sprite that you place along the sword.

    Anyways here's the point example way to do it. The sword has it's origin at the hilt and an imagepoint at the tip.

    on sword collides with enemy
    repeat 10 times
    pick enemy overlapping point (lerp(sword.x, sword.imagepointX(1), loopindex/9), lerp(sword.y, sword.imagepointY(1), loopindex/9)
    --- stop loop
    --- create particles at (lerp(sword.x, sword.imagepointX(1), loopindex/9), lerp(sword.y, sword.imagepointY(1), loopindex/9)

    OH MY GOD, I would never figure out it alone, thank you so much!!

  • I would really appreciate if someone has a better way to do it

  • A solution that comes to my mind, would be adding an image point to the position where the sword hits on the attack animation's last frames and sticking a small invisible sprite in it, which would then spawn particles on enemy collision.

    Go to the hero's sprite editor and add an image point, set it in the position you want, in this case select the frame where the sword hits and set the image point to the sword's tip.

    Then create a small sprite and make it invisible from its settings.

    Every time you hit, make the hero spawn the invisible sprite to the image point you made earlier. If you want to be exact about the timing, compare the frame and select the one where the sword is supposed to touch the enemy. Start a timer, to destroy the invisible sprite some time after the hit is finished.

    Check if the invisible sprite is in collision with the enemy and if it is, make it spawn the particles.

    So basically the blood comes from the hero sprite, not from the enemy. I'm not sure how well this solution works and I haven't used particles myself before, but this is what came to my mind first.

    thanks dude, it's not perfect at all (sometimes a bit strange) but for now a can use it

  • I want to when the sword hits the enemy, spawns particles where the colision happens, is it possible?

  • I want to make when ANY gamepad press start, put its ID to a variable, but idk how to pick any gamepad.

    Tagged:

  • I did it, for anyone who wants to know how to do it, here it is.

    that was the only way I found to do it.

  • in Zelda, has a peculiar thing in the movement which is, if you go to any 4 diretions (up,down,left,right) and then move to diagonals, link doesn't changes the sprite diretion, exemple: if you hold 'up', link looks up and then if you hold 'left', link goes to diagonal but stays looking up, but if you hold 'left' first and than hold 'up', link goes to the same direction but looking to left, I can't figure out how to do it.

    (I'm using 8-directions behavior and using a variable to store the player's direction based on motion)

  • That's a little more complicated: dropbox.com/s/aedegy6p8zaxi07/slipperystick.c3p

    Play with the pad variables for the slipping. Same for acceleration.

    Speaking of... I'm a little iffy on using gamepad axis=0 for a Bool. It might be an issue if you have a stick with unwanted drift.

    Ashley any way we could get something added to to account for when the stick is not in use?

    well, it works a bit strange here, the object speeds up a bit when I release the stick, but I think it's gonna work for now, thanks a bunch!

  • The stick already provides acceleration, and deceleration based on input.

    You can simply set position:

    Sprite.X+(Gamepad.Axis(0, 0)*yourspeed)*dt

    Sprite.Y+(Gamepad.Axis(0, 1)*yourspeed)*dt

    You can tweak the speed part if you need to adjust acc/dec. Lerp works nice.

    wow it seems to work better than custom movement, but actually I want to use acc/dec to simulate slipping, like walk on ice, can you do that? (sorry I wasn't very specific)

  • I wanted to make the player walk in all direction based on analog stick position, not only "8 directions" I know that I can do so using custom movement, but I need acceleration and deceleration that only 8 directions has, I'm without ideias T-T

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can apply effects to layouts.

    Click on the layout, add the fx in preferences.

    yep, but I need to apply the effect only on the magnifying glass not on the entire layout :/

  • hi guys! well, I saw in some topics/videos how to make a "magnifying glass" effect, but it works only if all the objects are in the same layer with 'force own texture' on, so how do I make it work to all layers?

ManoD's avatar

ManoD

Member since 12 Jul, 2020

None one is following ManoD yet!

Trophy Case

  • 4-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies