grimor Posted January 27, 2014 Share Posted January 27, 2014 I'm wondering about how to make melee attack collision detection. I've got a player spritesheet with attack animation, but don't know how to detect collision in front of my sprite in for example 30 pixels right. I was thinking about adding additional sprite on attack with hitbox which is 30px wide in front of my player, but don't know it is right thing to do. Link to comment Share on other sites More sharing options...
rich Posted January 27, 2014 Share Posted January 27, 2014 I would probably use a weapon specific hit box for this, yes. Link to comment Share on other sites More sharing options...
grimor Posted January 27, 2014 Author Share Posted January 27, 2014 Ok, so is there method to attach additional hitbox to a Sprite, or i have to make additional Sprite for that ? Link to comment Share on other sites More sharing options...
rich Posted January 27, 2014 Share Posted January 27, 2014 I would create a Player class which contained various sprites (body, weapon, maybe some other sensors you might need). Would like use a Group as its base. jamesflorentino and sparksflyupwards 2 Link to comment Share on other sites More sharing options...
grimor Posted January 27, 2014 Author Share Posted January 27, 2014 Yeah, i was started doing it already that way Ok, last question. If i make Player class, can I somehow put there game.load.spritesheet statements ? What i mean is can I "append" some code into preload(), create(), update(), render() methods from Player class ? Or it there other way to handle a lot of preloading code ? Link to comment Share on other sites More sharing options...
rich Posted January 27, 2014 Share Posted January 27, 2014 Sort of - a preload function won't be looked for or called automatically (because it's a class, not a state), but there is nothing stopping you from populating the Loader yourself and telling it to start loading. Link to comment Share on other sites More sharing options...
Recommended Posts