0 Members and 1 Guest are viewing this topic.
.PLATFORM[3810385410282828->Pic0[FFFFFFFFFFFFFFFF->Pic10->X40->YWhile 1ClrDrawPt-On(X,Y,Pic0For(A,0,96Pt-On(A,48,Pic1A+7->AEndDispGraph.pxl-Test(X,Y)r Returns 1 if pixel is black and 0 if pixel is white on the back buffer at (X,Y).If pxl-Test(X,Y+8)r=0Y+1->YElseEndIf getKey(3)X+2->XEndIf getKey(4)Y-2->YEndEnd
.PLATFORM[3810385410282828]->Pic0[FFFFFFFFFFFFFFFF]->Pic10->X40->Y.Game LoopWhile 1StorePic.Display Sprite in given coordinatesPt-On(X,Y,Pic0For(A,0,96Pt-On(A,48,Pic1A+7->AEndDispGraphPt-Change(X,Y,Pic0RecallPic .Key EventsIf getKey(3)X+2->XEndIf pxl-Test(X,Y-8) = 0Y+1->YEndIf getKey(4) and (Y>0)Y-5->YEnd.Close GameIf getKey(15)Fix 4ReturnEnd.End of Game LoopEnd
For(A,0,100 If A=(rand^100 Pt-On(10,10,Pic1 EndEnd
For(A,0,100) If A=(rand^100) Pt-On(10,10,Pic1) EndEnd
.PLATFORMFix 5[3810385410282828]->Pic0[FFFFFFFFFFFFFFFF]->Pic10->X40->YClrDraw.Main game loopWhile 1 .Moving right If getKey(3) X+2->X End .Jumping If Y>0 and getKey(4) Y-5->Y End .Create floor For(A,0,12) Pt-On(A*8,48,Pic1) End .Collision test (ground) and Gravity !If pxl-Test(X,Y+8) !If pxl-Test(X+7,Y+8) Y+1->Y End End .Display sprite Pt-On(X,Y,Pic0) .Display the screen DispGraph ClrDraw .Close Game If getKey(15) Fix 4 Return EndEnd
I've made a similar platformer that only moves in one direction, but its not done because of collision detection with incoming obstacles. What I did for jumping was have a variable called J for whether he's jumping or not, a var F for whether he's falling or not, and T as a timer, and V as the vertex, where he stays put in the air for 2-3 frames. (bad physics. )