View
Theme
Font Style
7pt
8pt
9pt
10pt
11pt
Line Style
100%
110%
120%
130%
140%
Bold Keyword
Default
Inspector
Kkaefer
Eclipse
SQ Light
Lesser
Dark
Cobalt
Monokai
Rubyblue
Night
SQ Dark
Ambiance
Blackboard
Line Num.
Wrap Lines
Preview
Redraw
JS Tab
HTML Tab
CSS Tab
Live Tab
Prev. Tab
Next Tab
Browser
History…
Help
Edit
Settings
Auto Complete
Match Brackets
Match Highlight
Strip Whitespace
Auto Close Brackets
Auto Close Quotes
Show Print Margin
Undo
Redo
Delete
Select Line
Select All
Find & Replace
Find
Find in Repo.
Find Next
Find Previous
Replace Single
Replace All
Wrap Search
Revert
As Template
Diff Revision
Format
Compress
Text
Zen Coding
Indent
Tab Width
1
2
3
4
5
6
7
8
Indent Unit
1
2
3
4
5
6
7
8
Smart Indent
Use Tabs
Visible Tabs
Shift Left
Shift Right
Put Indent
Number
Increment by 1
Decrement by 1
Increment by 0.1
Decrement by 0.1
Increment by 10
Decrement by 10
Simple Math
Comment
Line
Move Up
Move Down
Copy Up
Copy Down
Go to Line…
Remove Line
Next Point
Prev. Point
Help
Share
Login
You can jump to the latest bin by adding
/latest
to your URL
×
z
Find
→
←
⟲
Replace
⊗
All
Replace
soundManager.url = '/js/vendor/'; // directory where SM2 .SWFs live // Note that SounndManager will determine and append the appropriate .SWF file to the URL. // disable debug mode after development/testing.. soundManager.debugMode = false; // Option 2b: More flexible onready + createSound methods (good for multiple use cases) soundManager.onready(function(oStatus) { // check if SM2 successfully loaded.. if (oStatus.success) { // SM2 has loaded - now you can create and play sounds! var mySound = soundManager.createSound({ id: 'aSound', url: '/attach/wind.mp3' // onload: [ event handler function object ], // other options here.. }); loopSound('aSound'); } }); function loopSound(soundID) { window.setTimeout(function() { soundManager.play(soundID,{onfinish:function(){loopSound(soundID);}}); },1); } var MAX_HEIGHT = 300; var MAX_WIDTH = 600; var MARGIN = 2; var TOP_WALL = 0 - MARGIN; var BOTTOM_WALL = MAX_HEIGHT + MARGIN; var LEFT_WALL = 0 - MARGIN; var RIGHT_WALL = MAX_WIDTH + MARGIN; var LEAVES = 50; var RESISTANCE = 1.3; var GRAVITY = 0; var GUST = 1; function aLeaf(id, parent, x, y, onClick) /* * This is for leaves. */ { this.id = id; this.x = x; this.y = y; this.dx = (Math.random() * 10) - 5; this.dy = (Math.random() * 10) - 5; this.ddx = Math.random() - 0.5; this.ddy = Math.random() - 0.5; this.pageElement = document.createElement("div"); this.pageElement.codeObject = this; this.pageElement.setAttribute("id", "l" + this.id); this.pageElement.className = "leaf"; this.pageElement.style.background = "black"; this.pageElement.style.position = "absolute"; this.pageElement.style.width = "4px"; this.pageElement.style.height = "2px"; this.pageElement.setAttribute('title', 'a leaf'); parent.insertBefore(this.pageElement, null); if(typeof(onClick) != "undefined") this.pageElement.onmousedown = onClick; this.move = function () { this.ddx = gustX(x, y); this.ddy = gustY(x, y); this.dx += this.ddx; this.dy += this.ddy; this.dx /= RESISTANCE; this.dy /= RESISTANCE; // if(Math.abs(this.dy) > MAX_SPEED) this.dy = (this.dy / Math.abs(this.dy)) * MAX_SPEED; this.x += this.dx; this.y += this.dy; if(this.y < TOP_WALL) this.y = BOTTOM_WALL; if(this.y > BOTTOM_WALL) this.y = TOP_WALL; if(this.x < LEFT_WALL) this.x = RIGHT_WALL; if(this.x > RIGHT_WALL) this.x = LEFT_WALL; this.pageElement.style.left = parseInt(this.x) + "px"; this.pageElement.style.top = parseInt(this.y) + "px"; // sky.innerHTML += this.x + " "; } } gX = 0; gY = 0; gDX = 0; gDY = 0; function gustX(x, y) { // return (Math.cos(gDX + (x / 100) + (y / 200)) + gX); return (Math.cos((x / (MAX_WIDTH / 2))) + gX); } function gustY(x, y) { // return (Math.cos(gDY + (x / 100) + (y / 200)) + gY); return (Math.cos((y / (MAX_HEIGHT / 2))) + gY); } var thisStep = 0; function startStepping() {stepper();} function stepper() { if (thisStep % 33 == 0) //every second { // gDX = Math.random() * Math.PI; // gDY = Math.random() * Math.PI; gX = Math.random() + GUST; gY = Math.random() + GRAVITY; } for (x in leaves) leaves[x].move(); thisStep++; if (thisStep >= 400000) thisStep = 0; // to prevent overflow setTimeout("stepper();", 30); } var leaves = new Array(); var sky; var score; function onLoad() { sky = document.getElementById("sky"); score = document.getElementById("score"); for (var x = 0; x < LEAVES; x++) { leaves.splice(0, 0, new aLeaf(x, sky, Math.random() * MAX_WIDTH, Math.random() * MAX_HEIGHT, ouch)); } startStepping(); } var myScore = 0; var ouch = function(e) { myScore++; score.innerHTML = "Score: " + myScore; return 0; }
Leaves
a really simple game by
Derek
Have an idea to improve this game?
More Games
a.corner-link { background:url('http://gopherwoodstudios.com/i/flip.png') 5px 0px no-repeat; width:34px; height:30px; position:absolute; display:block; top:0px; right:0px; } a.corner-link:hover { background:url('http://gopherwoodstudios.com/i/flip.png') bottom left no-repeat; width:100px; height:100px; position:absolute; display:block; top:0px; right:0px; } a.corner-link span { display: none; }
Pop out
Help
About
×
×