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.
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
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
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.