Skip to content

Instantly share code, notes, and snippets.

@dermotbalson
dermotbalson / gist:6509753
Last active March 18, 2023 17:48
Pinball
--# Notes
--this project creates a simple pinball game
--instead of flippers, it uses a spherical controller to bounce the ball
--and the physics engine to manage all the collisions
--To run the final step, you will need all the images in this zipfile
--https://www.dropbox.com/s/uv3t6dawvcsh7d6/Pinball.zip
--You need to unzip them and copy them into the Dropbox folder you have linked to Codea, then
--go into Codea's dropbox library, and press the sync button tp download them
@dermotbalson
dermotbalson / gist:6509120
Last active March 18, 2023 17:47
Step by step sliding puzzle
--# Notes
--This is a simulation of an old puzzle game
--where you have a flat plastic surface with balls that roll around on it
--there are little holes you have to get the balls into by tipping the puzzle to roll the balls
--but there are obstacles, and if you tip too far, the balls come out again
--in this version, we'll start to build the puzzle, and when we add more than one ball, we'll
--start using physics to manage the ball collisions
@dermotbalson
dermotbalson / gist:6509302
Last active March 18, 2023 17:47
Physics
--# Notes
--This project shows to use some basic physics, from bouncing balls and spinning
--rectangles, to the basics of a very simple platform game
--HOW TO USE THIS PROJECT
--There are a number of tabs at the top. Press on a tab to see its code.
--Work through the tabs from left to right, to see the project develop
--# Notes
--[[
** What is a mesh? **
A mesh is a quick way of drawing a shape. It is a set of points which create an outline (or wirefame) of an object
It is made up of triangles (groups of three points)
Triangles are used because a triangle has the smallest number of points that encloses an area
Each triangle corner is known as a VERTEX, and has a position and a colour
The colours of all the points inside the triangle are interpolated from the colours of the three corners
@dermotbalson
dermotbalson / gist:7079524
Created October 21, 2013 06:37
Lunar landing 3a
--# Main
--The name of the project must match your Codea project name if dependencies are used.
--Project: 3D Lunar Landing
--Version: Alpha 1.12
--Comments:
--Main
states={Intro=0,Loading=1,Flying=2,Crashed=3,Landed=4,Walking=5}
newmtl gate
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
@dermotbalson
dermotbalson / gist:6546692
Created September 13, 2013 04:09
Step by step Template
--# Notes
--[[
This is a template for creating multi-tab projects
That is, projects where each tab can be run independently
This can be used for step by step tutorials, with users able to choose which tab runs
It can also be used for multi-stage projects, eg games where there are several stages like
* start menu
@dermotbalson
dermotbalson / gist:05d444f4c4a948650589
Last active February 21, 2021 03:28
Asteroids 3D
--Three D asteroids
--The comments below are aimed at a wide variety of users
--They may be too detailed or not detailed enough, I do my best!
--Comments and questions to ignatz on the Codea forum
--There is a lot of setup work to do, but note how it's packaged into separate functions to keep tidy
function setup()
Settings() --general settings
ast={} --table of asteroids to show on screen
FPS=60 --frame rate, to check it's not too slow
@dermotbalson
dermotbalson / gist:7706821
Last active June 23, 2019 08:45
Lighting library v2
--# Main
--Main
--This code manages which Code tab is run
--it remembers your last choice, and if you select a different one, it runs that instead
--This has nothing to do with 3D lighting and you can ignore it completely
--# Main
--Dungeon ver 1.0
--navigation
--touch left 1/3 of screen to turn left, right 1/3 of screen to turn right
--touch top 1/3 of screen to move forward, bottom 1/3 of screen to go backwards
--touch centre of screen to stop
--touching multiple times speeds up