Page 1 of 2

Collision maps/masks

Posted: Wed Jan 17, 2018 1:04 pm
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!

Re: Collision maps/masks

Posted: Sat Jan 20, 2018 12:04 pm
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 :)

Re: Collision maps/masks

Posted: Mon Jan 22, 2018 9:01 am
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..

Re: Collision maps/masks

Posted: Wed Jan 24, 2018 6:26 pm
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.

Re: Collision maps/masks

Posted: Thu Jan 25, 2018 9:20 am
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?

Re: Collision maps/masks

Posted: Sun Jan 28, 2018 9:52 pm
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 ;)

Re: Collision maps/masks

Posted: Mon Jan 29, 2018 10:23 am
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?

Re: Collision maps/masks

Posted: Mon Jan 29, 2018 6:37 pm
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.

Re: Collision maps/masks

Posted: Mon Jan 29, 2018 7:12 pm
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?

Re: Collision maps/masks

Posted: Thu Feb 01, 2018 6:38 pm
by airsoftsoftwair
Yes, that's planned.