Skip to content

Instantly share code, notes, and snippets.

View keomamallett's full-sized avatar

Keoma Mallett keomamallett

View GitHub Profile
@keomamallett
keomamallett / main.lua
Created April 27, 2019 17:50
This Lua/Love code moves a square across the screen and when the left side exceed the window width, the square reappears in the upper left of the window.
-- 1. in the draw function, update the code to set the rectangle to fill mode instead of line mode (***)
-- 2. in the draw function, update the code to centre the rectangle, in the game window (***)
-- 3. in the update function, update the code to make the rectangle move when you press the arrow keys
function love.load()
window_width, window_height = love.window.getMode()
rectOne = {}
rectOne.width = 200
rectOne.height = 150
@keomamallett
keomamallett / test.lua
Created April 20, 2019 17:38
This was created to share Lua code with my first student
function love.load()
x = 100
y = 100
width = 200
height = 150
speed = 75
end
function love.draw()
love.graphics.rectangle("line", x, y, width, height)
@keomamallett
keomamallett / phaser-demo-project-edit-game.js
Last active April 20, 2019 12:47
This gist was created to share the code for the phaser.io "Making your first Phaser 3 game", with a few adjustments of mine, with one of my students.
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
const TWO = 2;
var platforms;
var player;
var cursors;
var stars;
var bombs;
@keomamallett
keomamallett / phaser-07-keyboard-controls.js
Created April 19, 2019 03:59
This is my code for lesson number 7 in the player "Making your first Phaser 3 game" on phaser.io. I created this in case a student needs it for reference.
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
var config = {
type: Phaser.AUTO,
width: GAME_WIDTH,
height: GAME_HEIGHT,
physics: {
@keomamallett
keomamallett / phaser-05-player.js
Created April 18, 2019 15:54
This is my code for lesson number 5 in the player "Making your first Phaser 3 game" on phaser.io. I created this gist to show a student corrections for code he shared with me.
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
let config = {
type: Phaser.AUTO,
width: GAME_WIDTH,
height: GAME_HEIGHT,
@keomamallett
keomamallett / lua_love2d_installation.md
Last active April 17, 2019 02:05
How to install Lua, Love2D, and ZeroBrane on Linux

Notes: I indented for clarity. Only copy from the start to the end of the text on each line

Steps to install curl

sudo apt update
sudo apt install curl

Steps to install Lua:

curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
@keomamallett
keomamallett / sprites_in_ruby2d.rb
Last active April 18, 2019 17:43
This code shows the interaction between a character (sprite) and a sword (image). I created this for a student of mine to reference.
system('clear')
require 'ruby2d'
set title: 'Sprite animation'
set background: 'blue'
Zero = 0
# hero parameters