0 Members and 1 Guest are viewing this topic.
Quote from: Eiyeron on October 31, 2011, 12:48:18 pmbut collision s the most complicated!, Damn!Tile based works perfectly. I use this:Code: [Select]:If getKey(2) and (X≠0):sub(CC,X,Y,X,Y+7:!If R:X-1→X:End:EndJust to check for a tile on the left. Now you figure out how to check for tiles in the other 3 directions Code: [Select]:Lbl CC:{r2/8*12+(r1/8)+GDB1}→r5:{r4/8*12+(r3/8)+GDB1}→r6:r5+r6→R:Return
but collision s the most complicated!, Damn!
:If getKey(2) and (X≠0):sub(CC,X,Y,X,Y+7:!If R:X-1→X:End:End
:Lbl CC:{r2/8*12+(r1/8)+GDB1}→r5:{r4/8*12+(r3/8)+GDB1}→r6:r5+r6→R:Return
:If getKey(2):If X:!If CC(X,Y,X,Y+7):X--:End:End:End:::Lbl CC:{r2/8*12+(r1/8)+GDB1}→r5:{r4/8*12+(r3/8)+GDB1}→r6:r5+r6→R:Return
Changed for prettification and I think also speed gain:Code: [Select]:If getKey(2):If X:!If CC(X,Y,X,Y+7):X--:End:End:End:::Lbl CC:{r2/8*12+(r1/8)+GDB1}→r5:{r4/8*12+(r3/8)+GDB1}→r6:r5+r6→R:ReturnI just love function based programming so much
"welcome to the world of computers, where everything seems to be based on random number generators"
could someone please show me how to do this in lua?