Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

scrolling game, groups and hitbox


kiwi
 Share

Recommended Posts

Hi all,

 

I'm developing a game with a scrolling background.

I'm creating a series of houses (each house is a sprite randomly generate which are moved horizontally) with a chimney on top so I created a group and added each house in it. I'm trying to drop an object from the sky and detect if this object hits the chimney (only the chimney, not the roof). As far as I understood I need to separate chimney and house making the object I drop and the chimney "hittable". But, is correct to create a group (with all houses in it) with many groups in it (house + chimney) and detect the hitbox on the chimney? Is this the correct way to do it? Should I try a different approach?

 

thanks

Link to comment
Share on other sites

First, you should add the chimneys as children of the houses. Sprites can have children (like a group), and that's very handy because if chimney is a child of house, then when you move your house chimney will move with it. And you manage just one object, House (which has children like chimney, but you could add windows, doors etc.)

 

Then, I think I would put all the chimneys into a group for collision check.

 

So in the end, you need just one group.

Link to comment
Share on other sites

Skeptron is right: stick all those chimneys in a group and check collision against that. And then post a link to your Christmas game for us to play. ( =

 

I bet if you add the chimneys to a group they won't be children of the house sprites anymore. But I also don't think that'll matter.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...