Pixel collisions with Tilemaps in GameMaker Studio 2

preview_player
Показать описание
A quick tutorial on how to do pixel collision testing to the new tilemap system. This allows you more accurate collision testing, and to do slopes and curves using tilemaps.

NOTE: Some functions like buffer_surface_get() have changed, will will need updating to the new version in order to work.
Рекомендации по теме
Комментарии
Автор

Really love the mic distorting throat clearing at beginning lol

Carlosonebillion
Автор

For anyone like me who was having major headaches trying for hours to get this working with my own tiles remember that the TILE SIZE NEEDS TO BE A POWER OF 2 (I'm guessing because of the bitwise & operations). I was using an unusual size of 42 x 42 pixel tiles and it was giving me a really bizarre collision error.

sihy
Автор

EDIT # 2: Was able to resolve the error message. You need two rooms. First room has only the object0. The code must read goto next room(); at bottom of (object0) code. This takes you to room 2. Room two must only have the player object in it. You are storing all the data in the initial room. Moving to room two after where only the player exists(meaning no calculations happening with buffer while player is referencing things). If you are getting all the collisions as 16 or some odd stuff MAKE SURE ITS BUFFER"U"32

zeldwaugh
Автор

Would love to see an updated version of this for top-down games! I have watched this and done it for each direction, but I get weird jumping around in position when holding two directional buttons at the same time and am colliding with certain slopes.

ianpearson
Автор

You rock dude! Great, informative videos from a true dev!

knartfocker_
Автор

i am loving all these videos... by a true master.

Brian-vssd
Автор

How do you calculate the row for left and right collisions?

Valkyrion
Автор

I'm just double checking the process that your using is loading the tileset as a surface buffer, I was just curious cause I found another tutorial that used the surface get pixel he said that it was a more time consuming way of doing it so I wanted to try your way if it was faster and more efficient

alrightythen
Автор

idk if you still check this but for some reason it won't let me put any more variables on line 19, it says the max it takes is 3, and if i do buffer_surface_get(buff, surf, 0, 0, 0); it crashes immediately. it runs if i do just buffer_surface_get(buff, surf, 0); but i have no idea if that makes a difference or not realisitically.

goblingrowl
Автор

So, do we actually have to draw the tiles as part of the setup process, or can we skip it and go straight to determining heights?

blazecreates
Автор

So for some reason, I keep getting this error message at line 10 of TestCollision();

"trying to index a variable which is not an array
at gml_Script_TestCollision (line 10) - var hh = global.Heights[column];"

Can anyone help me with this?

MrLuigi-petn
Автор

Love your great software it's really helpful in my game design career as a Indy developer

aaronwise
Автор

Can you upload this project to media fire? I'd like to take a look at the code.

squidman
Автор

If I test the game in HTML5, the colisions don't work, somebody could help me?, I looked all the numbers but none seems to be wrong (none goes or any bug related to the compilation as far as I noticed it).

RaeldorDraken
Автор

I tried to reproduce the collision checking and doesnt work properly, the pizel urns red on de tiny downwards slopes when i enter the tile but there are no pixels, there is no collision in the big slopes or the full tiles. I don't know what can be the issue, I checked all the scripts and nothing seems wrong.

RaeldorDraken
Автор

Anyone else getting this error?


FATAL ERROR in
action number 1
of Draw Event
for object obj_tilecollision:

DoConv :1: illegal undefined/null use
at (line 24) - if ( != 0) break

littlesaigon
Автор

LOL, your throat clearing sounds just like me :) Giving this thumbs up before I even watch the vid, hahaha.

kennethkline
Автор

great video ! but scr_TestCollision at line 12 : unknown function or script Heights

everyone has the same error dude, any idea what kind of extension we are missing out >

gursegugu
Автор

for(var
{
var count = 0;
for(var yy=0;yy<TILE_SIZE;yy++){
var pixel = buffer_peek(buff, (xx+(yy*TILE_SIZE*TILE_MAX))*4, buffer_u32);
if( != 0 ) break;
count++;
}
global.Heights[xx] = count;
}
like how tf am i supposed to understand what this does

SonictheHedgehogInRealLife
Автор

i wish you explained things more i don't understand a single thing in this video.

SonictheHedgehogInRealLife