2D character controller basics by DeadTomGC12th Mar 2011 23:13
|
---|
Summary This is demo code for jump, left, and right control and collisions for a 2D game Character. Description This is demo code for jump, left, and right control and collisions for a 2D game Character. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com #include "methjump.h" void DarkGDK ( void ) { dbSyncOn ( ); dbSyncRate ( 60 ); dbLoadImage("sprite.bmp",1); dbSprite(1,0,0,1);//collision dbSprite(2,0,0,1);//visual dbHideSprite(1); dbSizeSprite(1,dbSpriteWidth(2)-2,dbSpriteHeight(2)-2);//give a one pixel margin dbSprite(3,0,200,1);////////////////// while ( LoopGDK ( ) ) { jump(); leftright(); dbSprite(2,x-1,y-1,1);//sync the images if ( dbEscapeKey ( ) ) break; dbSync ( ); } return; } |