Get help using GDevApp.
By Aaron Wiggan
#65423 Hi All,

I have researched the Wiki and the forums but am unable to find answers to my specific issues.

1. I have resized the default collider for my Player and Enemy sprites, to only include the area the colours pixels occupied. The problem I see is I have an even - when Enemy collides with Player, create object Blood1 (particle system). The sprites appear to collide, but it only seems to trigger at weird angles. The other problem is I want to blood to be created at the collision point. But I have not worked out how to achieve this. Aside from that I also have when Player & Enemy sprites come close, they seem to randomly rotate a bit, (I used forces and physics to move my Player & Enemy) is there to have them stay upright? If it helps I add a capture of my EventSheet.

2. My Player has an Axe and an Attack Animation. This is part of the Player sprite, not a separate object. But when I trigger the animate and the Axe collides with the Enemy I want that to inflict damage on the Enemy. How would you achieve this?

3. Background collisions - I want to constrain Enemy & Players only to the street portion of my background. I have put the background on a separate layer and set up a collision area. Are you able to allow collisions between layers?


Cheers A.

PS - Happy to provide more details on any point.
User avatar
By Lizard-13
#65425 Ok, let's check it out :)

1 -
The sprites appear to collide, but it only seems to trigger at weird angles

You are using the physics behavior, right?, did you set the physics collision mask or leave it as default?, maybe the physics collision mask is bigger than the sprite mask, then it depends on the collision condition you are using (physics or sprite mask) :|

These:
I want to blood to be created at the collision point

But when I trigger the animate and the Axe collides with the Enemy I want that to inflict damage on the Enemy

Are related:
Return the collision point would be great, but it's impossible right now :( , it's impossible to use a single hitbox to check collisions too. But you can use a workaround: Add a point on the axe location, if the axe moves you'll have to move the point each frame (take care of the sprite editor's button that moves your point along all the frames, deactivate it or you can lose all the changes!).
Now, add an object Axe, it's just a sprite to check collisions, put this object in the scene and, through events, make the Axe object to follow the axe point in the warrior sprite. It's possible now to check collisions between the Axe object and an enemy.
Finally, to get the collision point, a dirty way to get it is using a raycast (check the lazer and zombies example), start a "ray" from the axe center to the enemy center until the ray collides with the enemy, it's a good approximation of the first contact point if the objects are not so big.

:idea: I know it sounds difficult, but if you can send me a warrior with the attack animation I can show you da wae :arrow:

3 -
Are you able to allow collisions between layers?

Yes, absolutely, but you have to note something: When you work with layers, there are two different "worlds": what you see and the real world. The objects have an unique position, size, etc. in the "real world", and GD check these properties to do a collision test; but the layer's cameras can render each object at different position and size on the screen. Do you get it?, if you render a GUI button (in a GUI layer) always on the screen because you don't move the GUI layer's camera, and you have a player object at X = 5000 with a camera following it, the player and the button won't collide even if they are colliding "graphically".
For the street I would suggest to just check the Y position of the objects, limiting it to the upper and lower Y limits ;)
By Aaron Wiggan
#65451 Hi Lizard,

I am working my way through this. Point 1 is resolved, I am on to 2. What events are required to make the Axe sprite follow the player animation?

I have worked out how to do the points in the sprite editor.
User avatar
By Lizard-13
#65454
:idea: I know it sounds difficult, but if you can send me a warrior with the attack animation I can show you da wae :arrow:

You put the point in the the warrior sprite, at the axe position, then in an event without conditions do:
AxeEvents.png
AxeEvents.png (2.66 KiB) Viewed 1199 times

It will make the AxeHitbox object to follow the Axe point of the Warrior object.
Notice the AxeHitbox object will not rotate along the animation, will follow the position only, to make it to rotate you need two points in the Warrior object, not just one, but to test it I would need a real animation :|