Programs


Hello and welcome to the Programs devlog!

If you have a cool piece of code, made with Jassembly and want to share it, this is the right place!

If the code is especially good, it may be included in the "Other codes" article in the documentation!

Programs waiting to be implemented !
Pick one and start developing :)
  • [done] A 3D rotating cube
  • A raycasting labyrinth (Doom?)
  • Conway's game of life
  • Donkey Kong
  • Break out
  • Tetris
  • 2D maze generator (further combined with the ray caster)

Comments

Log in with itch.io to leave a comment.

#3D cube
const tickRate 3 op R0 = 0 op R40 = 0 #Y rotation op R44 = 0 #X rotation label mainLoop clear 0 #Top four points op R63 = R40 op R62 = R44 call renderPoint op R63 = R40 + 90 op R62 = R44 call renderPoint op R63 = R40 + 180 op R62 = R44 call renderPoint op R63 = R40 + 270 op R62 = R44 call renderPoint #Bottom four points op R63 = R40 op R62 = R44 * -1 op R62 += 180 call renderPoint op R63 = R40 + 90 op R62 = R44 * -1 op R62 += 180 call renderPoint op R63 = R40 + 180 op R62 = R44 * -1 op R62 += 180 call renderPoint op R63 = R40 + 270 op R62 = R44 * -1 op R62 += 180 call renderPoint display_color sleep tickRate #Rotate X op R40 += 2 op R40 = R40 % 360 #Rotate Y op R44 += 1 op R44 = R44 % 360 jump mainLoop #R63: angle Y #R62: angle X func renderPoint #Get point cos R63 R60 sin R63 R61 #Y scale sin R62 R59 op R59 += 100 op R59 /= 5 op R59 = 20 - R59 #Scale it op R60 /= 8 op R61 *= R59 op R61 /= 200 #Y offset cos R62 R59 op R59 += 100 op R59 /= 10 op R59 = 10 - R59 print R59 1 #Center it op R60 += 19 op R61 += 15 op R61 += R59 #Render it set_pixel R60 R61 3 return 0 #R60: x1 #R61: y1 #R62: x2 #R63: y2 func drawLine op R50 = R62 - R60 #dx op R51 = R63 - R61 #dy print_txt "dx: " 0 print R50 1 print_txt "dy: " 0 print R51 1 op R52 = R50 * R50 op R52 += R51 * R51 #dx**2 + dy**2 sqrt R52 R52 #length from x1;y1 to x2;y2 print_txt "Len: " 0 print R52 1 op R0 = 0 label lineLoop op R53 = R52 - R0 #progress print_txt "Progr: " 0 print R53 1 op R62 = R50 * R53 #offset x op R63 = R51 * R53 #offset y op R62 /= R52 op R63 /= R52 op R62 += R60 #line start pos x op R63 += R61 #line start pos y set_pixel R62 R63 9 op R0 += 1 if R0 <= R52 lineLoop return 0