How to create equivalent of a Gamemaker 'solid'

Blitz3D Forums/Blitz3D Tutorials/How to create equivalent of a Gamemaker 'solid'

Tobo(Posted 2012) [#1]
Title says it all really.

In 2D, say I want a few sprites to act as a solid, i.e. don't let the player sprite move beyond it. Is there an accepted way of going about this, other than arrays?

Apologies goes for such a crap question.


Tobo

[Dammit dammit dammit - can a mod move this to Beginners forum please. Sorry!]

Last edited 2012


Yasha(Posted 2012) [#2]
Something like RectsOverlap or ImagesCollide may be of some use to you here. You can check the position that the player is going to be moved to and see if it's legal by testing whether any of it falls within one of these off-limits areas. Described in GML terms here: http://soulred12.wordpress.com/2008/07/04/game-maker-solid/ (ignore the stuff about parent object types, none of which has any B3D equivalent)

There is no direct equivalent of the "solid" property itself, because Blitz's 2D images aren't really dynamic "things" existing in a movement-space, they're just pictures you can draw any old where (the builtin 2D engine is really, really primitive - don't expect much from it). They don't move or bounce off each other or anything - even ImagesCollide is just a fancy way of checking whether they overlap. You have to write the code to replicate a lot of this stuff and implement collision systems and so on in B3D - or, more sensibly, look up a decent existing 2D library and see who's done it already for you! Draw3D, Sprite Candy, nSprite2 etc. are all B3D code libraries much more powerful than B3D's supplied 2D engine and may be more similar to what you know from Game Maker.

Don't worry - it's not a crap question at all as it highlights several core differences that need to be overcome if you're going to switch engine.

Last edited 2012


steve_ancell(Posted 2012) [#3]
If you're using plain old 2D then User Defined Types are your best friend. ;)


ShadowTurtle(Posted 2015) [#4]
t'hor arrays (tilemap based collisions)