0 Members and 1 Guest are viewing this topic.

.TRY07AXEClrDraw[3C7EFFFFFFFF7E3C]->Pic01[FF818181818181FF]->Pic02.L1{0,2, 4, 6.L1{X,Y,vX,vY1000->{L1+0}^r1000->{L1+2}^r200->{L1+4}^r100->{L1+6}^r.Direction(X,Y)=T,U1->T->U.Pos Player *100 = V,W5000->V1000->W.Gravitation=G0->G.N=NotCollide to prevent double collision0->N.C=Counter0->CRepeat getKey(15)C++ClrDrawPt-On({L1+0}^r/100,{L1+2}^r/100,Pic01)Pt-On(V/100,W/100,Pic02)DispGraph{L1+0}^r+({L1+4}^r*T)->{L1+0}^r{L1+2}^r+({L1+6}^r*T)->{L1+2}^rprgmTRY07MOVprgmTRY07COLprgmTRY07GRVEnd

..TRY07MOV.DownArrowKeyIf getKey(1) and (W<5600):W+100->W:End.LeftArrowKeyIf getKey(2) and (V>0):V-100->V:End.RightArrowKeyIf getKey(3) and (V<8600):V+100->V:End.UpArrowKeyIf getKey(4) and (W>0):W-100->W:End

..TRY07COL.DOUBLECOLLIDEN-1->N:If N=(0-1):0->N:End.COLIDE.Top LeftIf (N=0) and (({L1+0}^r/100)>=((V/100)-7)) and (({L1+0}^r/100)<=((V/100)-6)) and (({L1+2}^r/100)>=((V/100)-7)) and (({L1+2}^r/100)<=((V/100)-6)):{L1+4}^r+80->{L1+4}^r:{L1+6}^r+80->{L1+6}^r:(0-1)->T->U:5->N:0->G:End.Top RightIf (N=0) and (({L1+0}^r/100)>=((V/100)+7)) and (({L1+0}^r/100)<=((V/100)+7)) and (({L1+2}^r/100)>=((V/100)-7)) and (({L1+2}^r/100)<=((V/100)-6)):{L1+4}^r+80->{L1+4}^r:{L1+6}^r+80->{L1+6}^r:1->T:(0-1)->U:5->N:0->G:End.Bottom LeftIf (N=0) and (({L1+0}^r/100)>=((V/100)-7)) and (({L1+0}^r/100)<=((V/100)-6)) and (({L1+2}^r/100)>=((V/100)+6)) and (({L1+2}^r/100)<=((V/100)+7)):{L1+4}^r+100->{L1+4}^r:{L1+6}^r+100->{L1+6}^r:(0-1)->T:1->U:5->N:End.Bottom RightIf (N=0) and (({L1+0}^r/100)>=((V/100)+6)) and (({L1+0}^r/100)<=((V/100)+7)) and (({L1+2}^r/100)>=((V/100)+6)) and (({L1+2}^r/100)<=((V/100)+7)):{L1+4}^r+100->{L1+4}^r:{L1+6}^r+100->{L1+6}^r:1->T->U:5->N:End.TopIf (N=0) and (({L1+0}^r/100)>=((V/100)-5)) and (({L1+0}^r/100)<=((V/100)+5)) and (({L1+2}^r/100)>=((V/100)-8)) and (({L1+2}^r/100)<=((V/100)-6)):{L1+6}^r+100->{L1+6}^r:(0-1)->U:5->N:0->G:End.LeftIf (N=0) and (({L1+0}^r/100)>=((V/100)-8)) and (({L1+0}^r/100)<=((V/100)-7)) and (({L1+2}^r/100)>=((V/100)-5)) and (({L1+2}^r/100)<=((V/100)+5)):{L1+4}^r+80->{L1+4}^r:5->N:If ({L1+2}^r>5500):(0-1)->U:{L1+6}^r+80->{L1+6}^r:{L1+4}^r+20->{L1+4}^r:End:End.RightIf (N=0) and (({L1+0}^r/100)>=((V/100)+7)) and (({L1+0}^r/100)<=((V/100)+8)) and (({L1+2}^r/100)>=((V/100)-5)) and (({L1+2}^r/100)<=((V/100)+5)):{L1+4}^r+80->{L1+4}^r:5->N:If ({L1+2}^r>5500):(0-1)->U:{L1+6}^r+80->{L1+6}^r:{L1+4}^r+20->{L1+4}^r:End:End.BottomIf (N=0) and (({L1+0}^r/100)>=((V/100)-5)) and (({L1+0}^r/100)<=((V/100)+5)) and (({L1+2}^r/100)>=((V/100)+7)) and (({L1+2}^r/100)<=((V/100)+8)):1->U:G/5+{L1+6}^r/2+50->{L1+6}^r:0->G:End.BORDERS.LeftIf ({L1+0}^r<100) or ({L1+0}^r>(0-1000)):100->{L1+0}^r:1->T:End.RightIf ({L1+0}^r>8600):8600->{L1+0}^r:(0-1)->T:End.TopIf ({L1+2}^r)<100):100->{L1+2}^r:1->U:({L1+6}^r/2)->{L1+6}^r:End.BottomIf ({L1+2}^r)>5600):5600->{L1+2}^r:(0-1)->U:((G/10)+{L1+6}^r)->{L1+6}^r:0->G:End

..TRY07GRV.FrictionIf {L1+4}^r>50:{L1+4}^r+99/100->{L1+4}^r:Else:If {L1+4}^r<20:If (C/4+4)=C:{L1+4}^r*99/100->{L1+4}^r:End:Else:If (C/2+2)=C:{L1+4}^r*99/100->{L1+4}^r:End:End:End.Slow down and speed upIf U=1:{L1+6}^r*102->{L1+6}^r:Else:{L1+6}^r*97->{L1+6}^r:End:{L1+6}^r/100->{L1+6}^r.Add GravityG+3->G:G/10+{L1+2}^r->{L1+2}^r

0->G.N=NotCollide to prevent double collision0->N.C=Counter0->C

If U=1:102:Else:97:End+{L1+6}^r->{L1+6}^r

If getKey(1) and (W<5600):W+100->W:End.LeftArrowKeyIf getKey(2) and (V>0):V-100->V:End.RightArrowKeyIf getKey(3) and (V<8600):V+100->V:End.UpArrowKeyIf getKey(4) and (W>0):W-100->W:End

If W<5600 and getKey(1):W+100->W:EndIf V>0 and getKey(2):V-100->V:EndIf V<8600 and getKey(3):V+100->V:EndIf W>0 and getKey(4):W-100->W:End

W<5600 and andgetKey(1)-(W>0 and getKey(4))*100+W->WV<8600 and getKey(3)-(V>0 and getKey(2))*100+V->V

L1+00->°PosXL1+02->°PosYL1+04->°VXL1+06->°VY

......[3C7EFFFFFFFF7E3C]->°BallSprite[FF818181818181FF]->°PlayerSprite......Pt-On({L1+0}^r/100,{L1+2}^r/100,°BallSprite)Pt-On(V/100,W/100,°PlayerSprite)......

.TOASTER......Add(3,4)->A......ReturnLbl Addr1+r2Return

G+3->G:G/10+{L1+2}^r->{L1+2}^rCan beG+3->G:/10+{L1+2}^r->{L1+2}^rIf there is no var/number before the "/10", then it just uses the last value. (in this case G+3)

2) Custom variables.Instead of having a comment saying "L1{X,Y,vX,vY" then using a lot of these "{L1+__}^r", you could use custom variables.How? Well just try that:Code: [Select]L1+00->°PosXL1+02->°PosYL1+04->°VXL1+06->°VYThen do stuff with PosX, PosY and others as if they were variables. Like 0->PosX, PosX++, etc. It works.Your names can contain 13 characters max. That's enough for most uses.Code: [Select][3C7EFFFFFFFF7E3C]->°BallSprite[FF818181818181FF]->°PlayerSprite......Pt-On({L1+0}^r/100,{L1+2}^r/100,°BallSprite)Pt-On(V/100,W/100,°PlayerSprite)......Same, 13 characters max.

[3C7EFFFFFFFF7E3C]->°BallSprite[FF818181818181FF]->°PlayerSprite......Pt-On({L1+0}^r/100,{L1+2}^r/100,°BallSprite)Pt-On(V/100,W/100,°PlayerSprite)......

4) Subprograms.I'd say they should only be used as a compilation of subfunctions you didn't want to put in the main file (to save space or have less lines or whatever), but having them in a loop the way you did is a bad idea. You seem to think this works the same way as in basic, which is "there is no custom subfunctions but there are subprograms that are not pasted everytime". Well it's exactly the contrary, there are subfunctions in Axe and subprograms are pasted everytime.To use a subfunctions, do like that:Code: [Select].TOASTER......Add(3,4)->A......ReturnLbl Addr1+r2Return

5) Optimization.Well, I'm not talking about that one. Readability is better for beginners.

5->°SuperAwesome3->AA+SuperAwesome->A

{L1+2}^r->°xBallA{L1+102}^r->°xBallB{L1+202}^r->°xBallCfor(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):end

wooow, wait a sec *-*Code: [Select]{L1+2}^r->°xBallA{L1+102}^r->°xBallB{L1+202}^r->°xBallCfor(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):endThis would actually work? It would display all three values?So I can then access the stuff both by using the fancy name xBallA AND by using the momory position {L1+2}^r I love this language... >.>

I guess this Add is an example for a subroutine... Do I have to give the variables as parameter or can it just access the vars, too?That would be a problem since I'm gonna change a lot of stuff for example in the colission program (G, xPos, YPos, vX, vY, T, U)Aaand do I need to add a "Return" too at the end of the subroutine as long as my subroutine shouldn't return a specific value but rather change a lot of vars...?

Woah, Woah, Woah! hang on a sec!Custom variables need a MEMORY LOCATON not a number!L1+102->°xBallB would be the correct way to declare it.Disp xBallB={L1-102}r >Decshould then always display true (1).It needs a memory loction because, of course, you can't create memory. It needs a place to store its data.edit: i'm not sure you can start a variable with a lowercase though...

L1+2->°xBallAL1+102->°xBallBL1+202->°xBallCfor(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):end

edit: i'm not sure you can start a variable with a lowercase though...

And the Return is the end of the subroutine. Even if it returns nothing, you must finish with a return.And the same way G+3->G:/10 worked, the r1+r2:Return works.

......DoStuff( )->Z......ReturnLbl DoStuff5->A:Return

......DoStuff( )->Z......ReturnLbl DoStuff5->AReturn

......DoStuff( )......ReturnLbl DoStuff5->A:Return

So this Subfunction DoStuff would actually do 5->A->Z:Code: [Select]......DoStuff( )->Z......ReturnLbl DoStuff5->A:ReturnBut this one would not return anything so be an error?Code: [Select]......DoStuff( )->Z......ReturnLbl DoStuff5->AReturn

......Lbl Stuffsr1*r2->r5r3*r4->r6Return r5+r6......

Is it a problem if a called Subfunction returns some value but It's not used afterwards...?Or is it optional to use the returned value, no matter if there is one or not?

A+3*3->B

FacebookandTwitterFollow @Codewalr_us