Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Roundy roundy! #1

Merged
merged 1 commit into from over 2 years ago

2 participants

Nik Coughlin Dominic Tarr
Nik Coughlin

Stars round, slightly offwhite

Dominic Tarr
Owner

cool,
thinking of expanding this into a tunnel flyer game...

Dominic Tarr dominictarr merged commit 4995573 into from
Nik Coughlin
Dominic Tarr
Owner

nah, simpler.

not general purpose 3D engine, just a really simple one. you only fly in one direction (tunnel, not maze) through holes in parallel walls...

... so that rendering order is trivial, and there is a minimum to draw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 11, 2012
Nik Coughlin nrkn Round stars, ever so slightly off white e64b8ff
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 26 additions and 7 deletions. Show diff stats Hide diff stats

  1. +26 7 canvas.html
33 canvas.html
... ... @@ -1,5 +1,3 @@
1   -
2   -
3 1 <!doctype html>
4 2 <html>
5 3 <head>
@@ -14,7 +12,6 @@
14 12
15 13 body {
16 14 background: #eee;
17   - padding: 1em;
18 15 }
19 16
20 17 #c {
@@ -40,12 +37,34 @@
40 37 canvas.height = window.outerHeight
41 38 canvas.width = window.outerWidth
42 39
  40 +//make stars slightly off-white
  41 +function colorByte(){
  42 + var variance = 32;
  43 + return Math.floor( ( Math.random() * variance ) + ( 256 - variance ) );
  44 +}
  45 +
43 46 function createStar () {
44   - var g = new Graphics()
45   - g.setStrokeStyle(1)
46   - g.beginFill(Graphics.getRGB(255,255,255,1));
  47 + var g = new Graphics(),
  48 + red = colorByte(),
  49 + green = colorByte(),
  50 + blue = colorByte(),
  51 + radius = Math.floor( Math.random() * 8 ) + 2,
  52 + center = radius / 2;
  53 +
  54 +
  55 + g.setStrokeStyle(1);
  56 +
  57 + //star
  58 + g.beginFill(Graphics.getRGB(red,green,blue,1));
  59 + g.drawCircle( center, center, radius );
  60 + g.endFill();
47 61
48   - g.drawRect(0,0, 10, 10);
  62 + /*
  63 + //corona
  64 + g.beginStroke(Graphics.getRGB(red,green,blue,.25));
  65 + g.drawCircle( center, center, radius + 1 );
  66 + g.endStroke();
  67 + */
49 68 return new Shape(g);
50 69 }
51 70

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.