Collision maps/masks

Find quick help here to get you started with Hollywood
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Collision maps/masks

Post by Figgy78 »

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!
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair »

Have you had a look at Collision()? If this doesn't do what you need, please explain why it doesn't serve your needs :)
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Re: Collision maps/masks

Post by Figgy78 »

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 :)
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.

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..
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair »

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..
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
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Re: Collision maps/masks

Post by Figgy78 »

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 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?
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?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair »

Figgy78 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?
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 mean ;)
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Re: Collision maps/masks

Post by Figgy78 »

Well.. Again.. I don't know if this is common practice, but I have seen this in other game engines..

Image

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?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair »

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.
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Re: Collision maps/masks

Post by Figgy78 »

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.
Wow.. that was quick! I can't believe how great the support for Hollywood is. Kudos to the team.

Are we expecting a new release this spring?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair »

Yes, that's planned.
Post Reply