Collision maps/masks
Collision maps/masks
Hi!
I'm trying to make a simple top-down car game where the car stays in center and the background moves in all directions below.
I have set this up with a sprite for the car and the background as a large brush.
How do I create a collision mask for the background image? I can't see any documentation for anything like this in the manual. Is it even possible to set up collision between a brush and a sprite?
Thanks!
I'm trying to make a simple top-down car game where the car stays in center and the background moves in all directions below.
I have set this up with a sprite for the car and the background as a large brush.
How do I create a collision mask for the background image? I can't see any documentation for anything like this in the manual. Is it even possible to set up collision between a brush and a sprite?
Thanks!
- airsoftsoftwair
- Posts: 5461
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Collision maps/masks
Have you had a look at Collision()? If this doesn't do what you need, please explain why it doesn't serve your needs
Re: Collision maps/masks
Hi, I'm starting to suspect I'm an idiot, but my main issue was not being able to do any type of collision between sprites and brushes.airsoftsoftwair wrote:Have you had a look at Collision()? If this doesn't do what you need, please explain why it doesn't serve your needs
Now I realize I could probably just do a collision between ie. the alpha of a brush (background) using the #BRUSH_VS_BOX command? I guess I would have to set the box coordinates using the coordinates of my Player sprite.
Is there a technical reason why there isn't ie. a #BRUSH_VS_SPRITE or #SPRITE_VS_LAYER command? That would make more sence in my head, but I'm not an experienced programmer..
- airsoftsoftwair
- Posts: 5461
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Collision maps/masks
Well, sprites versus layers won't work because sprites and layers are mutually exclusive. #BRUSH_VS_SPRITE could be added if there's demand for it.Figgy78 wrote:Is there a technical reason why there isn't ie. a #BRUSH_VS_SPRITE or #SPRITE_VS_LAYER command? That would make more sence in my head, but I'm not an experienced programmer..
Re: Collision maps/masks
I see! I'm not sure what's common practice, as I'm not an experienced programmer. How would you set up collision with a masked out area on the screen?airsoftsoftwair wrote:Well, sprites versus layers won't work because sprites and layers are mutually exclusive. #BRUSH_VS_SPRITE could be added if there's demand for it.
I would think using a brush with an alpha vs a sprite with an alpha would be the easiest way, but I'm guessing there are coding techniques that I don't know about to handle this scenario better?
- airsoftsoftwair
- Posts: 5461
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Collision maps/masks
I'd say it depends on how you draw this masked out area. Do you draw this using brushes or sprites? It's hard to imagine, maybe provide a little demo so I can see better what you meanFiggy78 wrote:I see! I'm not sure what's common practice, as I'm not an experienced programmer. How would you set up collision with a masked out area on the screen?
Re: Collision maps/masks
Well.. Again.. I don't know if this is common practice, but I have seen this in other game engines..
The White area would be the collision area and the Black is where I can drive my car..
I thought maybe this would be made in the most easy way using with the car as a sprite and the alpha as a brush?
The White area would be the collision area and the Black is where I can drive my car..
I thought maybe this would be made in the most easy way using with the car as a sprite and the alpha as a brush?
- airsoftsoftwair
- Posts: 5461
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Collision maps/masks
Yes, I think it would make sense to do it like this. I've just added a new #SPRITE_VS_BRUSH collision type that you can use in the next version. Until then, just keep a copy of your sprite as a brush and use type #BRUSH instead.
Re: Collision maps/masks
Wow.. that was quick! I can't believe how great the support for Hollywood is. Kudos to the team.airsoftsoftwair wrote:Yes, I think it would make sense to do it like this. I've just added a new #SPRITE_VS_BRUSH collision type that you can use in the next version. Until then, just keep a copy of your sprite as a brush and use type #BRUSH instead.
Are we expecting a new release this spring?
- airsoftsoftwair
- Posts: 5461
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Collision maps/masks
Yes, that's planned.