hitbox+sprite workaround

0 favourites
  • 9 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • Hey guys,

    i would like to ask you for your help. The problem is am using for my plaformer for the enemy enemy.hitbox+enemy.sprite. But somehow am strugling with it. Mainly when collison between them happens or enemy.hitbox collide with a shot. I have to specify which sprite have to play animation. I want ot ask if there is any way that i can make like one object of those htibox+sprite soo if anything happens to this object i dont have to specify what animation have to play it will just look for animation in that enemy container. And if I want to create more enemy i would just like duplicate that container.

    I hope i do sound a bit reasonable ;)

    thx for any help.

  • You could test by checking parity between the count of enemy animation sprites and enemy hitbox sprites, if there is a difference, test each for overlapping and if the hitbox is not overlapping an animation sprite at the same location , spawn one.

    Or just spawn/pin each time an enemy is created in a single event.

    It's still a little messy keeping track of things - I have some pinned stuff for debugging purposes in a game I'm working on and have to check the pin status of the animation sprites, and destroy them if the object they were pinned to was destroyed.

    Hopefully there'll be support soon with spriter integration for a generic hitbox for a character sprite.

  • thanks for the tip johny, honestly it still left me abit clueless ..but i will try to look more on it as you described it.

  • Providing your .capx here might be helpful.

  • Well there isnt much to show anyway its just simple hitbox+animation sprite technique. It working great for main player but for multiple enemy its just a poblem. Thanks for help anyway

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I put one example together, there are hitboxes with an ID and also AnimBoxes with ID. I made events to set positions of hitbox and animobox only with the same ID. I know those events arent very "nice" could you pls tell me some other more dynamic way i can set positions of those two objects with the same ID together. I would like to do it in the way that every tick set all animbox to position of hitbox with the same ID.

    https://dl.dropbox.com/u/23856304/example.capx

    PS: By ID here i mean instance variable wich i made for them.

    Thank you for help. It looks simple ..how ever am really strugling with this :)

  • So I spent some more time on it and found really easy solution. Soo if anybody interested you may look at https://dl.dropbox.com/u/23856304/example2.capx

    If somebody have even better solution am all open for it.

    Martin

  • Every tick -> AnimBox Set position to Hitbox

  • Thx for reply ramones but thats not working in condition I need.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)