0 Members and 2 Guests are viewing this topic.
:.This is the sprite:[80C0A09088D0A818]→Pic1:While 1:.Store the screen to the back buffer:StorePic:.Display Sprite:Pt-On(X,Y,Pic1:DispGraph:.Erase Sprite:Pt-Change(X,Y,Pic1:.Replace the part of the image erased by the Sprite:RecallPic :.I used conditionals because the boundary conditions are important:.Replace with X+getKey(3)-getKey(2)→X if they aren't important.:If getKey(3) and (X<92):X+1→X:End:If getKey(55) and (X<72):Pt-On(X,Y,Pic1+8:End:If getKey(2) and (X>2):X-1→X:End:If getKey(1) and (Y<60):Y+1→Y:End:If getKey(4) and (Y>2):Y-1→Y:End:End
.MOUSE[101010FE10101000]->Pic1While 1.Store the screen to the back bufferStorePic.Display SpritePt-On(X,Y,Pic1DispGraph.Erase SpritePt-Change(X,Y,Pic1.Replace the part of the image erased by the SpriteRecallPic .I used conditionals because the boundary conditions are important.Replace with X+getKey(3)-getKey(2)->X if they aren't important.Repeat getKey->ZEndIf Z=15Goto 9ElseIf getKey(3) and (X<92)X+1->XEndIf getKey(55) and (X<72)Pt-On(X,Y,Pic1+8EndIf getKey(2) and (X>2)X-1->XEndIf getKey(1) and (Y<60)Y+1->YEndIf getKey(4) and (Y>2)Y-1->YEndEndEndLbl 9
.MOUSE[101010FE10101000]->Pic1While 1.Store the screen to the back bufferStorePic.Display SpritePt-On(X,Y,Pic1DispGraph.Erase SpritePt-Change(X,Y,Pic1.Replace the part of the image erased by the SpriteRecallPic .I used conditionals because the boundary conditions are important.Replace with X+getKey(3)-getKey(2)→X if they aren't important.If getKey(3) and (X<92)X+1→XEndIf getKey(55) and (X<72)Pt-On(X,Y,Pic1+8EndIf getKey(2) and (X>2)X-1→XEndIf getKey(1) and (Y<60)Y+1→YEndIf getKey(4) and (Y>2)Y-1→YEndgetKey(15)End
getKey(15) will equal 1 if the clear key is being held down and 0 if it isn't. That's all it does. If you want it to actually do something useful, you have to put it as the condition in an if statement and then put what you want it to do as the contents of the if statement.
If getKey(15)Goto 9End.The next line is the last oneLbl 9
Code: [Select]If getKey(3) and (X<92)X+1→XEndIf getKey(2) and (X>2)X-1→XEndIf getKey(1) and (Y<60)Y+1→YEndIf getKey(4) and (Y>2)Y-1→YEnd
If getKey(3) and (X<92)X+1→XEndIf getKey(2) and (X>2)X-1→XEndIf getKey(1) and (Y<60)Y+1→YEndIf getKey(4) and (Y>2)Y-1→YEnd
X<92 * getKey(3) - (X>2 * getKey(2)) + X -> XY<60 * getKey(1) - (Y>2 * getKey(4)) + Y -> Y
Quote from: ScoutDavid on December 05, 2010, 10:31:29 amCode: [Select]If getKey(3) and (X<92)X+1→XEndIf getKey(2) and (X>2)X-1→XEndIf getKey(1) and (Y<60)Y+1→YEndIf getKey(4) and (Y>2)Y-1→YEndcould be Code: [Select]X<92 * getKey(3) - (X>2 * getKey(2)) + X -> XY<60 * getKey(1) - (Y>2 * getKey(4)) + Y -> YI think this gives a speed increase and lowers the byte size.It should also make the game speed slightly more stable, although this is so small that that wouldn't be noticed here.
.MOUSE[101010FE10101000]->Pic1While 1.Store the screen to the back bufferStorePic.Display SpritePt-On(X,Y,Pic1DispGraph.Erase SpritePt-Change(X,Y,Pic1.Replace the part of the image erased by the SpriteRecallPic .I used conditionals because the boundary conditions are important.Replace with X+getKey(3)-getKey(2)→X if they aren't important.If getKey(3) and (X<92)X+1→XEndIf getKey(55) and (X<72)Pt-On(X,Y,Pic1+8EndIf getKey(2) and (X>2)X-1→XEndIf getKey(1) and (Y<60)Y+1→YEndIf getKey(4) and (Y>2)Y-1→YEndIf getKey(15)Fix 4ReturnEndEnd
return, while not part of a subroutine quits the program.I always have fix 4 because i always use fix 5.