Sidescrolling Platformer Template wip

Hi All,

I’m currently working on a sidescrolling platformer template to advance my knowledge of Python. It’s at a very early stage and is slightly buggy though I’ll be working on this for several weeks to ensure it’s suitably polished.

My reason for posting prematurely is that I’d really like to know what people think the template should include? What sort of interactions, whether things need tweaking or whether stuff just doesn’t work.

Video:
http://angrymangogames.com/henry/platformervideoscreen.jpg

Download (executable only, .blend to come soon):
http://angrymangogames.com/henry/platformerPrototype.zip

Features:

  • Left and right movement
  • Single and double jump
  • Easing camera. Tilts in direction of play. Invisible square with no camera position change.
  • Destroyable boxes from underneath
  • Collectable coins with GUI counter
  • Dynamic moving platforms. No IPO’s. Physics objects stick.
  • Dynamic enemies that move left and right. No IPO’s. Detect obstacles and stop.
  • Health GUI. Dynamic player vertex colour change on health deduction.
  • Dynamic objects locked to X and Z axis’
  • Water

Todo:

  • Fix jump reset when play origin Zaxis not inline with floor
  • Fix buggy platforms
  • Create level beginning/end camera locks
  • Change camera to place player in bottom third intersection furthest from direction of play
  • Make objects not directly touching platform still affected (i.e. a box on a box)
  • Make vertex colour changes fade in and out
  • Health GUI counter dynamic vertex colour fade (green>red)
  • Loads more cool stuff (springs, powerups, switches, doors, etc)

How did you manage to get physics objects to stick to the platforms? That’s one thing that’s always bugged me…

How did you manage to get physics objects to stick to the platforms? That’s one thing that’s always bugged me whenever I try to make a sidescroller

Yeah it was definitely a problem. I just wrote a small script that updates the collision object position as well as the platform. This script isn’t really applicable outside of this template yet, but it should give you an idea.


#Stick player and objects with mass to platform
if collide.hitObject != None:	
	for i in range(0, len(collide.hitObjectList)):
		cx,cy,cz = collide.hitObjectList[i].position
		#Left
		if collide.hitObjectList[i].mass > 0 and owner["platCollide"] == 0:
			cx = cx-.1
			if collide.hitObjectList[i] == player: #cx should work for player but doesn't for some reason so this exception is used
				px = px-.1
			#change direction if object caught
			if cx <= platx - 4 and cz <= platz +1.5 and cz >= platz -1.5:
				owner["platCollide"] = 1
		#Right
		if collide.hitObjectList[i].mass > 0 and owner["platCollide"] == 1:
			cx = cx+.1
			if collide.hitObjectList[i] == player:
				px = px+.1
			#change direction if object caught
			if cx >= platx + 4 and cz <= platz +1.5 and cz >= platz -1.5:
				owner["platCollide"] = 0
		collide.hitObjectList[i].position = cx,cy,cz

Well, it looks just…perfect?!
Great work!
Bravo!
Keep Blending!
Bye

It looks really well done. If youa re using vertex colours you should find out that they don’t work with rigged models. So if you ever use something other than a box, the vertex colours won’t work as an option (made me really anoyed when I found out). You could use Ob colour though, That can work. even with rigged characters.

In that case, you should use an IPO. on the IPO curve editor you can find scale, rotation etc… but also ColR, ColB, ColG and ColA. Make sure whatever else you do that ColA is set to 1. you can use it to fade out dead enemies too. Also on the texture tabe you’ll need to click the OBcolour button (it is near shadeless).

Ah thanks for the heads up - I had no idea vertex colours didn’t work with rigged models. The reasoning behind using vertex colours and not IPO’s was that the template user could easily plug in any model and the effect will be the same across all models. I guess that isn’t the case :confused:

Yeah, it’s a pain in the neck. I wanted to use rays to add black spots to a model to represent damage. I wrote a whole script for it, then foud it only works on unrigged objects. Good for the ground or buildings, but no good for the player model or enemies.

It only takes a few seconds to add an IPO though, and once you have some available, you can add them to any new model imported.