A downloadable asset pack

Buy Now$9.99 USD or more

The perfect starting engine for your 2D side scrollers, platformers, and action RPGs! This engines main feature is the code which runs the collision system, which has been formatted to be pixel perfect and run against both blocks and slopes for the widest variety in gameplay.

Extensive commenting makes the code quite valuable as a learning tool and an excellent addition to any programmers arsenal for competing in jams to producing full scale games! The example project contains a fully function player object which has either keyboard or joystick support (depending on what's plugged into the system), supports multiple states and actions, and can interact with various objects in the room.

Features (v1.0):

  • Pixel-perfect collisions
  • Slope collisions
  • Collision with both objects and tiles
  • State of the art State Engine (as of 2020)
  • Pushable objects
  • Variable jumping
  • Coyote time
  • Fall-through/Jump-through platforms
  • Moving platforms
  • Crush deaths
  • Disappearing blocks
  • Variable terrain (with varying accelerations, such as ice floors)
  • Ladders
  • Controller support


Note: Requires GameMaker Studio v2.0 or higher to run

Purchase

Buy Now$9.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $9.99 USD. You will get access to the following files:

2D Side Scrolling Collision System.yyz 2.4 MB

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.