Log In  

67

Cart [#37402#] | Copy | Code | 2017-02-12 | Link
67

I have taken my most recent Pico-8 game Kid Bludd, stripped it down to the essentials, and I am releasing it as a kind of Platforming Game Starter Kit.

I removed all logic that isn't game agnostic, so it is hopefully a good starting point for pretty much any platformer.

It's not super complicated, but does a lot of stuff I see many games not doing, which I consider table stakes for a platformer that feel good.

Features the basics:

  • Animation System
  • Collision Routines
  • Camera (w/Shake)
  • But also...

Forgiving Jumps

This one is very subtle but one of the most important pieces of a platformer. In general the player can only jump if they are on the ground, but this can make the game feel unresponsive when trying to make precision jumps. To give the player some leeway, the game allows jumps for a few frames after the player leaves a platform, and also registers jump presses if they came a few frames before landing.

Mario Sliding

When you change direction while moving, there is a bit of a slide before moving in the new direction.

Air and Ground Friction

Tunable values for both how much the player slows down while in the air and when touching the ground. This is critical for allowing the player to land on small platforms, while maintaining a good feeling in the air.

Variable Jump Height

Tap to jump a small amount, and hold to jump higher. Again very critical for precision jumps.

Pass Through Floors

Some floors allow the player to jump up through them, but not down. Really important for any levels with verticality, but also fun for horizontal scrollers.

Camera Scrolling Threshold

This cart uses the same camera style as metroid, where the player must leave a small area in the center of the screen before it starts scrolling. This give the player the freedom to make minor movements without causing nauseating camera movements.

This is a follow up to my original cart: "Micro Platformer - Simple Platforming Engine in 100 Lines of Code". If you are new to programming, I strongly suggest starting with that cart, as it is much simpler to follow!

Cart [#28248#] | Copy | Code | 2016-09-09 | Link
31


Old Versions:


Cart [#37157#] | Copy | Code | 2017-02-04 | Link
67

P#37158 2017-02-04 19:18

:: YOU ARE AWESOME

This is such pure awesomeness, a mega valuable resource and wonderful square one to begin a game jam from! You are a hero! I cannot wait to dive in and make my 1st pico8 game using this! Thank you so much for this perfect starting point.

P#37162 2017-02-04 21:41

::

I've been diving into the code of that game to make sense of some of those mechanics and animations. You are awesome, dude! Thanks!

P#37163 2017-02-04 22:01

::

Wow, nice! Been gradually fumbling my way through figuring these things out myself. Will be great to see some good examples!

P#37165 2017-02-05 00:38

::

This is awesome! Thank you for this amazing work man!

P#37170 2017-02-05 06:14

::

This is awesome! Thanks so so much!

P#37186 2017-02-05 15:40

::

I love you. This is totally awesome!

P#37192 2017-02-05 19:05

::

Very valid to things I'm making!! Thank you, and hopefully this can translate to my projects easily... I've already got a little wip on them though...

P#37233 2017-02-06 20:31

::

This is really good! There's a glitch where you can zip up a wall if you jump into a corner at the right angle.

P#37295 2017-02-08 16:18

::

Thank you :)

P#37297 2017-02-08 18:04

:: FROM THE AUTHOR

@ianh: Thanks for reporting the bug! Never seen it before but within 1 minute of trying I was able to do it! I'll try to get a fix in; should be just a matter of adding more collision points on the player's head (to match what is on his feet).

@everyone else: Thanks so much for the positive words! Let me know if you make anything, or have any questions about the engine!

P#37300 2017-02-09 00:46

:: FROM THE AUTHOR

Version 1.1 Uploaded:

  • Fixes to collision routines (thanks @ianh).
  • Camera now follows in Y (not just X).
  • Supports sprites of any size (not just 8x8).

Here is a little demo I did of a platformer using 16x16 sprites:

Cart [#37404#] | Copy | Code | 2017-02-12 | Link
4

P#37406 2017-02-12 20:13

::

This is such a great addition to the community. Definitely going to be using this for one of my projects. Thank you mhughson!

P#37463 2017-02-14 16:52

::

Absolutely phenomenal. For someone who knows so little about coding, this is a beaut!

P#37478 2017-02-15 04:05

::

@mhughson I haven't had time to code anything, but this looks like a great foundation for my platformer. Thanks for sharing it!

I noticed a collision error when the player sprite walks all the way left - it overlaps the background a pixel. Is the code collision checking every pixel in the sprite against the background?

P#38122 2017-03-09 12:26

::

@LeeStewart: It does not check for collision on every pixel. It only checks a few points, but the issue you are seeing is because the sprite is not centered and I check the same offset amount on both sides (so on right it is perfect, but on left it is off by one). See function collide_side(self) for more details.

P#38128 2017-03-10 02:16

::

@mhughson: the top pixel (113) should be 114 no ? Because 113 block has the 0 flag so it should not be possible to go to the next level ?

P#38874 2017-03-30 07:36

::

Not sure if anyone really cares, but I got rid of the overlap when colliding left, which @LeeStewart mentioned, by adding 0.5 to the offsets for self.dx<0, in lines 75-80:

    --elseif self.dx<0 then
        if fget(mget((self.x-(offset+0.5))/8,(self.y+i)/8),0) then
            self.dx=0
            self.x=(flr((self.x-(offset+0.5))/8)*8)+8+(offset+0.5)
            return true
        end

Thanks for this awesome tool! :D

P#40803 2017-05-20 17:01

::

@mhughson This is a fantastic demo cart, I think I might try to get it to work with split screen! I have a demo from last year with doing split screen stuff, not sure how out of date it is. https://www.lexaloffle.com/bbs/?tid=27696

P#43766 2017-08-30 17:19

::

@HotSoup: That would be cool! Let me know if you get anywhere with it!

P#44173 2017-09-14 01:07

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2017-10-17 11:24 | 0.262s | 1835k | Q:60