Collision maps/masks

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

Collision maps/masks

Post by Figgy78 » Wed Jan 17, 2018 2:04 pm

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: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair » Sat Jan 20, 2018 1:04 pm

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

Re: Collision maps/masks

Post by Figgy78 » Mon Jan 22, 2018 10:01 am

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: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair » Wed Jan 24, 2018 7:26 pm

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

Re: Collision maps/masks

Post by Figgy78 » Thu Jan 25, 2018 10:20 am

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: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair » Sun Jan 28, 2018 10:52 pm

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

Re: Collision maps/masks

Post by Figgy78 » Mon Jan 29, 2018 11:23 am

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: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair » Mon Jan 29, 2018 7:37 pm

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

Re: Collision maps/masks

Post by Figgy78 » Mon Jan 29, 2018 8:12 pm

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: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Collision maps/masks

Post by airsoftsoftwair » Thu Feb 01, 2018 7:38 pm

Yes, that's planned.

Post Reply