Platformer Template WIP

Hello :slight_smile:

So I just got done working on the Koins of Kain game with a few friends. Now I would just like to thoroughly explore the makings of a good 2d platformer using the Blender GE. When I’m done with this project I’ll post a guide or faq or a tut or something for the beginner to get into making a platforming game with the BGE.

I’m not thinking about graphics at all. In fact I’ve basically turned off world visual effects and am giving all objects the flat look, even making my camera orthographic. Most of the “game” will be white squares on a black background.

In other words,

This test is all about the programming and the physics which go into making a platforming game. I really want to make reusable solutions to problems like double-jumping, moving platforms, maybe working on the memory usage if that’s at all possible. I’m a Python neophyte so bear with me. But I’ll try to do as much as possible using logic bricks so that in the end anyone can just jump in with the template and make their game.

Update in like 5 seconds!

Thanks and happy blending!

– hackedmind

So this is the first file.

Here I tried to get the jumping and left-right motion down.

Jumping is handled this way: if the player presses the jump key AND the jump count is less than 2, the character will receive an upward velocity and the jump count will be increased by 1. If the character touches ground, the jump count will be reduced to zero. This works okay if there are no ledges, but I need to make it so that the character can only jump once if he falls off an edge.

The left-right motion is messed up because when you push against a wall, it pushes back, and when you let go of the key you go flying. I’ll fix this somehow.

Also notice I turned gravity off and simply have a downward force always being applied to the playcube (I’ll call it that from now on :slight_smile: ). I don’t know if this is a good idea or not, but it helps me keep my thoughts more organized (somehow :P).

See you soon.

– hacked

So I fixed the double jump error. Now if you fall of the edge of the stage you can only jump once.

Here is how my double-jump logic works.

always force player downward
if player touches ground then jump counter = 0
if player leaves ground then jump counter = 1
if player hits “w” and jumpcounter is 1 then jump counter = 2
if player hits “w” AND jumpcounter < 2 then move upward

I’ve fixed the motion errors as far as being repelled too strongly by the wall. Instead of using a simple motion actuator with the basic “Loc” motion, I’m now using Linear Velocity. This means that the playcube won’t try to go through the wall when moving, like it does with “Loc” motion.

This unfortunately also means that I have to deal with friction on the ground yadda yadda blarg :frowning: . But I think I have almost the right settings for a basic platfomer. The ground has a material with friction at 2.00 and the playcube has a Damp setting of 0.40 . This keeps the playcube from sliding around too much without taking too long to begin moving. I’ll have to play with the settings and learn more but I’m pretty happy here for now.

Next is platforms and walls. One of the problems that I’ve seen is that sometimes the player character will be able jump again after having only touched the very edge of a platform. I’m not entirely sure how to solve this, it’ll take some tinkering xD (maybe a little research too…). Walls have to have no friction so that the player can’t push against them to remain magically suspended in midair.

After I’ve figured out the edge-of-platform thing, I’m going to work on moving platforms… which I’m looking forward to }=D

My goal is to perfect the controls, environment, physics, and streamline the logic before trying to make anything “beautiful”. But I feel a beauty in just getting things to work smoothly.

see you 'round

– hackedmind

A good start.

May I advise you to use the Force, with a higher setting for damp, instead of LinkV? If you use Force, you will get a much smoother gameplay and if you put the damp higher, you will prefend the cube from slipping.

Hi Mirata! Thanks for you suggestion. I found that even with damp set up to 1000 there was still some slip. It might have to do with friction etc. etc. idk. I still have a lot to learn!

Been on the road but I’ll be working on platforms again here soon.

Thanks for your interest :slight_smile:

Yes, but slip isn’t always a bad thing. Infact, if you look at some of the big platform games like the Mario serie’s, Little Big Planet or Loco Roco, you will see that the main character will always keep on walking a while after you’ve stoped pushing the button (slip).
A cube that stops immediately after releasing the button feels unnatural.

But that’s just my opion, it’s you’r game. :slight_smile:

<3 LocoRoco <3 :smiley:

You know, you’re right. The thing is finding balance between how hard it is to get the character moving and how long he slips after releasing the button. I need to get home so I can do some “research” on my Mario games :stuck_out_tongue: