Thursday, September 3, 2009

TileMax

Well, aren't I a happy camper.  I finally have a character that can run and jump around my map.  As a matter of fact, so far I have added about 320 characters jumping on it with no apparent slowdown.  This is good news.  They all reference the gravity and friction of the specific tile they occupy so this should create some fun map building.  I'm still tweaking the movement behavior since there is a couple of anomalies with how I have implemented the collision system.  Rather than going for a pixel perfect collision system I opted for "feelers" that I call appendages.  This allows much faster collision checking and it also allows the character to grow to whatever size I want without compromising speed.  

I've also added animations for the characters that are named.. so for example here is control code for a right keypress...

If KeyDown(KEY_RIGHT)
If player.touching
player.MoveRight()
player.StartAnim("walk right",False,True)
player.CurrentAnim.Play(Abs(player.vx)*.15)
EndIf
EndIf

and here's how you create the anims..

Local e:Actor=Actor.CreateActor(m,tx,ty)
Local an:Anim=e.CreateAnim("walk left",walksprite,240,296,0.01)
an.AddFrames(0,5,0,4)
an.scaleX=-0.15
an.scaleY=0.15
an=player.CreateAnim("walk right",walksprite,240,296,0.01)
an.AddFrames(0,5,0,4)
an.scaleX=0.15
an.scaleY=0.15

Over and out for now...

No comments:

Post a Comment