Hi! I recently tried out the engine and fired it up to test it out of the box, no tinkering around in it or anything. When I ran the game, it gave me an error:
Object: obj_tile_init Event: Draw at line 18 : wrong number of arguments for function buffer_get_surface
Hey Scribbler, thanks for the bug report! Seems that in 2.3.1 they updated the function to no longer need to specify the buffer constant used. You can now simply define the function as follows.
Nice job so far. This caught my interest as I have written pixel perfect collision more times than I care to remember and always keen to see what others have done.
To solve your problem with pushable crates on slopes.. you should preprocess the level to remove solid vertical edges that touch. Then when you detect a collision on the x axis, you check the facing edge first. If its been culled you can ignore that tile, otherwise you collide against it.
Does your engine handle pushing multiple crates, e.g. push one crate into another and they all move and collide? I have an engine with that working but it caused a few headaches!
Also just curious, I notice you have blue markers and a green horizontal line, are these used for the collision checks?
Good luck with your sales, this is a very reasonable price for the features you have offered.
I actually do that, there's a variable you can use to control how many collision points you want to ignore from the base while walking up a slope. It's set to 2 by default (the character has 3 vertical collision points). The problem with the box is it's so wide that the mid-point of the box (which detects if it's on a slope) isn't able to make contact with the slope before hitting the solid tiles behind the second slope tile from the base. If your steep hill is only 1 high, it's just fine. Works well on the "hill" to the right of the starting point as well. As long as you start your slope with a "shallow slope" to lead in, it will work fine.
And yes, the markers/lines are collision points and the outline of the hitbox used for collisions.
Unfortunately the boxes are treated as solids, so you cannot push multiple boxes with my current code. However, you could probably add that capability by putting a collision test with a box object into the box object, and directing the moving box to add its momentum to the colliding box and forcing execution of second boxes step event before finishing its own
In this tutorial asset I have used a depth mask for determining how far the player should sink into a tile position. If you hit me up on r/gamemaker Discord I'd be glad to learn more about your bit masking method.
← Return to asset pack
Comments
Log in with itch.io to leave a comment.
Hi! I recently tried out the engine and fired it up to test it out of the box, no tinkering around in it or anything. When I ran the game, it gave me an error:
Object: obj_tile_init Event: Draw at line 18 : wrong number of arguments for function buffer_get_surface
The line of code in question is as follows:
buffer_get_surface(_tile_buffer,_surf,buffer_surface_copy,0,0);
Which argument(s) should I remove or modify to correct the error?
Hey Scribbler, thanks for the bug report!
Seems that in 2.3.1 they updated the function to no longer need to specify the buffer constant used. You can now simply define the function as follows.
buffer_get_surface(_tile_buffer, _surf, 0);
Your fix works! Arigato!
Nice job so far. This caught my interest as I have written pixel perfect collision more times than I care to remember and always keen to see what others have done.
To solve your problem with pushable crates on slopes.. you should preprocess the level to remove solid vertical edges that touch. Then when you detect a collision on the x axis, you check the facing edge first. If its been culled you can ignore that tile, otherwise you collide against it.
Does your engine handle pushing multiple crates, e.g. push one crate into another and they all move and collide? I have an engine with that working but it caused a few headaches!
Also just curious, I notice you have blue markers and a green horizontal line, are these used for the collision checks?
Good luck with your sales, this is a very reasonable price for the features you have offered.
Forgot to mention, regarding the preprocessing, in GMS2 I used tilemap bit masking to store cull bits for the vertical edges:
https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/rooms/tilemaps/tilemap_set_mask.html
I actually do that, there's a variable you can use to control how many collision points you want to ignore from the base while walking up a slope. It's set to 2 by default (the character has 3 vertical collision points). The problem with the box is it's so wide that the mid-point of the box (which detects if it's on a slope) isn't able to make contact with the slope before hitting the solid tiles behind the second slope tile from the base. If your steep hill is only 1 high, it's just fine. Works well on the "hill" to the right of the starting point as well. As long as you start your slope with a "shallow slope" to lead in, it will work fine.
And yes, the markers/lines are collision points and the outline of the hitbox used for collisions.
Unfortunately the boxes are treated as solids, so you cannot push multiple boxes with my current code. However, you could probably add that capability by putting a collision test with a box object into the box object, and directing the moving box to add its momentum to the colliding box and forcing execution of second boxes step event before finishing its own
In this tutorial asset I have used a depth mask for determining how far the player should sink into a tile position. If you hit me up on r/gamemaker Discord I'd be glad to learn more about your bit masking method.