Simon’s Codea Tutorials and the Arc-Tangent

A set of awesome Codea tutorials that Simon recorded for those who are just starting to program in Codea. Simon ported examples from Processing (java) into Codea (Lua):

In the second tutorial (in two parts), Simon explains how to write a physics simulation program in Codea using forces like gravity, friction and spring force. Anyone watching will get to use some trigonometry and see what arc-tangent is for! The original code in Java comes from Keith Peters (Processing).

Here are some notes from when Simon was explaining the arc-tangent to me the other day:

DSC_0716

 

Back to Python (and C#)!

Simon was preoccupied with vector functions for most of the day on Saturday, compiling what, at first site, looked like a monstrously excessive code in Processing (he recycled some of it from the Processing forum, wrote some it himself and translated the rest from Codea). Originally, he was gong to use the code to expand the 3D vector animation he made into a roller-coaster project he saw on Codea and wanted to create in Processing, but got stuck with the colors. What happened next was fascinating. In the evening I all of a sudden saw Simon write in a new online editor Repl.it – he was translating the vector code into… Python! He hadn’t used Python for quite a while. I don’t know what triggered it, maybe Daniel Shiffman noting last night during the live stream session that “normal people use Python for machine learning”. Simon also said he had sone some reading about Python at Python for Beginners and Tree House!

He isn’t done with his project in Python yet, but here is the link to it online: https://repl.it/JAeQ/13

Here Simon explains what he is writing in Python:

Simon did the 2D, 3D and 4D classes but eventually got stuck with the matrix class in Python. He then opened his old Xamarin IDE and wrote the 2D, the 3D and the 4D classes in C#. In the video below he briefly shows his C# sketch and talks about Cross Product in general:

And this is a video he recorded about vector functions (in Processing, Java) the day before:

Simon solved the bug in his Bit Invader game!

Simon actually managed to solve the bug in his Bit invader code! This is a game he was translating from Codea into JavaScript, we have already published a blog post about it here.

The project is available on Simon’s page in Codepen:

https://codepen.io/simontiger/project/editor/AdyVmr/

In the two videos below Simon explains what the bug was (he had forgotten a “break” statement). He insisted I include both videos, but actually only the second one is informative:

 

Simon still needs to add explosions to this game (make the enemies explode), so there will probably be a follow-up on this one.

 

Translating Bit Invader from Codea into JavaScript

Simon tried to reconstruct Bit Invader game (from Codea.io) in JavaScript, but got stuck at a certain point when he was programming the enemy to recognize the hero and the bullets. Here is how far he got. The project is available on Simon’s page in Codepen:

https://codepen.io/simontiger/project/editor/AdyVmr/

 

RGB Project in Codea using SVG Color Map

On Monday this week Simon spent hours converting hexadecimals into RGBA values for the 140 colors supported by all modern browsers and creating a color file in Codea. He used the w3schools color map available at https://www.w3schools.com/colors/colors_groups.asp and an html color codes converter http://html-color-codes.info/ 

Some of the color names were quite exotic (like Chartreuse or Bisque ), and we looked those up together in the dictionary. We also took a very close look at the relation between red, green and blue values and found out that red was added every time to make colors lighter, even in shades where you would not expect any red.

Simon later made a nice design pattern in Codea using the color file: