hitbox+sprite workaround

Discussion and feedback on Construct 2

Post » Tue Sep 04, 2012 6:29 pm

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.
B
16
S
4
G
3
Posts: 14
Reputation: 3,141

Post » Tue Sep 04, 2012 8:46 pm

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.

Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Tue Sep 04, 2012 10:23 pm

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.
B
16
S
4
G
3
Posts: 14
Reputation: 3,141

Post » Tue Sep 04, 2012 11:02 pm

Providing your .capx here might be helpful.
B
28
S
6
G
5
Posts: 248
Reputation: 5,463

Post » Wed Sep 05, 2012 2:11 pm

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
B
16
S
4
G
3
Posts: 14
Reputation: 3,141

Post » Thu Sep 06, 2012 3:12 am

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 :)
B
16
S
4
G
3
Posts: 14
Reputation: 3,141

Post » Thu Sep 06, 2012 11:40 am

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
B
16
S
4
G
3
Posts: 14
Reputation: 3,141

Post » Thu Sep 06, 2012 12:44 pm

Every tick -> AnimBox Set position to Hitbox
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Thu Sep 06, 2012 1:48 pm

Thx for reply ramones but thats not working in condition I need.
B
16
S
4
G
3
Posts: 14
Reputation: 3,141


Return to Construct 2 General

Who is online

Users browsing this forum: Arima, Paradox and 6 guests