help, I don't know how to use mget() and fget
essentially, mget(x, y) takes a tile's x and y position on the map, and returns the tile id of it (a number) . It's often used for collision in platformers.
Fget(tile_id, flag) works in a similar manner, however fget() returns a boolean value. it will return true if the tile ur checking has that flag, and false if it doesnt. To define a tile's id, go to the sprite editor, and click the little switch underneath the sprite editor logo (at the top) You'll then be in advanced mode, and see some new stuff appear. Focus on the numbers with boxes on the left. These are the flags you can use to define how a tile may act. For example, clicking the button next to 0 will make a red dot appear, and will make this tile have a flag of 0. This could be used to determine whether a tile is solid or semi-solid. You can also use multiple flags per tile, but keep in mind you only have 8 of them.
Hope this helps you in some way!
:D
mget usually works for collision on a tile. Take this function: map(0,0)
Then you have a player:
spr(1,x *8,y *8)
WHY *8 here? Because a tile is usually 8 by 8. And we need it for collision. This is my personal favorite approach. Alternatively you could divide it in the mget function by 8.
So if you want to make a collision, with my style:
if mget(x,y)==tile_1 then print(“cool”) end It will print cool.
Now mget(x,y)==tile_1 is specific to map(0,0)
So you what you want to do is to have mget(x+levelx,y+levely)==tile_1 to make it dynamic to each level.
–if you collide with tile_1 then you print cool if mget(x+levelx,y+levely)==tile_1 then print (“cool”) end