I have a bad code block, needs some optimization. Help much appreciated.
Code:
I got most of the bugs out of it, only one left is one that deals with F and jumping.
I am trying to get it to jump, but fall after ~5 runs through the movement code. It just has a little trouble jumping/falling.
Also, it runs slower than I would like it to, if it's possible to speed it up that would be great. Thanks!
Code:
[[12,13,13,13,13,13,13,13][12,13,13,13,13,13,13,13][12,13,13,13,13,13,13,13][12,13,13,13,13,13,13,13][12,13,13,13,13,13,25,25][12,25,25,25,25,26,6,13][15,27,13,13,13,13,13,0]]->[A] //Matrix for map
{2,3,4,7,8,15,49,53}->L1 //Key codes to accept
{5,6,8,13,27}->L2 //Blocks you can walk through
//Setup Stuff
Func
StoreGDB 1
FnOff
PlotsOff
AxesOff
CoordOff
ExprOff
GridOff
RectGC
ClrDraw
Full
ZStandard
ZInteger
UnArchive Pic1
Horizontal ~25
DrawTileMap(0,0,0,8,7,2,10,0,7,1,0,8,1
DelVar IDelVar JDelVar KDelVar HDelVar FDelVar G32->A:48->B:1->E
DrawSprite(A,B,1,8,1,7,0,3,1
While K!=15 //Code Loop for everything
//pixel to matrix #
A/8-1->C
B/8+1->D
If max(K=L1 //If it gets a key, remove sprite
DrawSprite(A,B,1,8,1,7,0,3,0,1
If H //If jump and move, erase/draw sprite
DrawSprite(I,J,1,8,1,7,0,3,0,1
GetKey( //real(8
Ans->K
If max(K=L1) or H //If you have moved, draw sprite
DrawSprite(A,B,1,8,1,7,0,3,0,1
//Code for detecting jump/ drawing
DelVar H
not(not(F->G
F-(F!=0->F
If not(F) and G
1->H
//movement
If (K=3 or K=8) and C<8
Then
If max([A](D,C+1)=L2
A+8->A
End
If (K=2 or K=7) and C>1
Then
If max([A](D,C-1)=L2
A-8->A
End
B-8(K=4 and max([A](D-1,C)=L2->B
If C>1
B-8(K=7 and max([A](D-1,C-1)=L2->B
If C<8
B-8(K=8 and max([A](D-1,C+1)=L2->B
If (A!=I or B!=J) and F
Then
DelVar FDelVar HDelVar G
End
A/8-1->C
B/8+1->D
(K=4)->E
//code to help you fall so you don't float
If D<7:Then
If max([A](D+1,C)=L2)
Then
A->I
B->J
If not(E) or K=2 or K=3
B+8->B
7->F
DelVar H
End
End
//code to see what F is doing
Text(~1,0,0," "
Text(~1,0,0,F
DelVar E
End
I got most of the bugs out of it, only one left is one that deals with F and jumping.
I am trying to get it to jump, but fall after ~5 runs through the movement code. It just has a little trouble jumping/falling.
Also, it runs slower than I would like it to, if it's possible to speed it up that would be great. Thanks!