Skip to content

Instantly share code, notes, and snippets.

Avatar

codebykeoma codebykeoma

View GitHub Profile
@codebykeoma
codebykeoma / main.lua
Created Apr 27, 2019
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.
View main.lua
-- 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
@codebykeoma
codebykeoma / test.lua
Created Apr 20, 2019
This was created to share Lua code with my first student
View test.lua
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)
@codebykeoma
codebykeoma / phaser-demo-project-edit-game.js
Last active Apr 20, 2019
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.
View phaser-demo-project-edit-game.js
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
const TWO = 2;
var platforms;
var player;
var cursors;
var stars;
var bombs;
@codebykeoma
codebykeoma / phaser-07-keyboard-controls.js
Created Apr 19, 2019
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.
View phaser-07-keyboard-controls.js
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
var config = {
type: Phaser.AUTO,
width: GAME_WIDTH,
height: GAME_HEIGHT,
physics: {
@codebykeoma
codebykeoma / phaser-05-player.js
Created Apr 18, 2019
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.
View phaser-05-player.js
const ZERO = 0;
const GAME_WIDTH = 800;
const GAME_HEIGHT = 600;
let config = {
type: Phaser.AUTO,
width: GAME_WIDTH,
height: GAME_HEIGHT,
@codebykeoma
codebykeoma / lua_love2d_installation.md
Last active Apr 17, 2019
How to install Lua, Love2D, and ZeroBrane on Linux
View lua_love2d_installation.md

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
@codebykeoma
codebykeoma / sprites_in_ruby2d.rb
Last active Apr 18, 2019
This code shows the interaction between a character (sprite) and a sword (image). I created this for a student of mine to reference.
View sprites_in_ruby2d.rb
system('clear')
require 'ruby2d'
set title: 'Sprite animation'
set background: 'blue'
Zero = 0
# hero parameters
You can’t perform that action at this time.