Skip to content

Instantly share code, notes, and snippets.

View tmcw's full-sized avatar
💭
merging your prs

Tom MacWright tmcw

💭
merging your prs
View GitHub Profile
@tmcw
tmcw / -
Created February 26, 2014 21:15
commit 3147a89a48a587b8dbc4720beaad55b3a2540fad
Author: Tom MacWright <macwright@gmail.com>
Date: Mon Feb 7 11:22:14 2011 -0500
Rename mess to carto.
diff --git a/Makefile b/Makefile
index ab44b13..0f67af7 100644
--- a/Makefile
+++ b/Makefile
@tmcw
tmcw / m2.html
Created February 28, 2014 20:35
<html>
<head>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' />
<link href='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/MarkerCluster.css' rel='stylesheet' />
<link href='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/MarkerCluster.Default.css' rel='stylesheet' />
<script src='//api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script>
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/leaflet.markercluster.js'></script>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A Simple Map</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' />
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A Simple Map</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' />
# Mission: Losing the Game
Let's figure out how to lose the game. Right now you can see what happens
when you collide with something: something like
```js
collision: function(other) {
other.center.y = this.center.y; // follow the player
other.center.x = this.center.x; // follow the player
}

Mission: Losing the Game

Let's figure out how to lose the game. Right now you can see what happens when you collide with something: something like

collision: function(other) {
  other.center.y = this.center.y; // follow the player
  other.center.x = this.center.x; // follow the player
}
@tmcw
tmcw / editors.md
Last active August 29, 2015 13:57

Context: a class of 10 9th-12th graders doing a week-long class on HTML, CSS, and JavaScript.

The question of an editor. While we stay in guided environments like jsbin & mistakes.io for the first two days of class, in order to save to files and tinker, we eventually need to ‘save to disk’ to view things as real websites and understand how code works.

I use vim personally, but know very well that it’s a tough place to start for students, and would be a dangerous distraction from the topics.

What really matters for an editor in this setting:

  1. It should be simple to use. This means keystrokes do what they do in other programs, like Word.
  2. It should not crash.

Next Challenge: Making things look awesome

Let's draw some sprites: these are the images that show when you see characters and other stuff in levels. They'll give this more personality than rectangles.

First: sprites are images. Let's draw our first sprite: open up http://pixelartor.com/ and create a new 64x64 image. Draw what you want, like a person or an obstacle or something else.

Save your image to the same directory as your game, and name it something you'll remember, like player.png

Next:

Gravity!

Okay, a function for gravity. let's look at it piece by piece then throw it in:

update: function() {

  // this is where the ground is on your level. adjust to fit.
  var ground = 300;
@tmcw
tmcw / index.js
Created March 10, 2014 17:00
Gist from mistakes.io
a = 2;