Skip to content

Instantly share code, notes, and snippets.

View teddykishi's full-sized avatar
💭
I may be slow to respond.

Teddy Kishi teddykishi

💭
I may be slow to respond.
View GitHub Profile
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;
@teddykishi
teddykishi / gist:dfb4ddc8f2d8c89a8447
Created July 14, 2014 13:38
Get list of data attributes using with jQuery
(function($) {
$.fn.allData = function(){
var elements = [], data;
this.each(function(){
data = $(this).data();
elements.push(data);
});
return this.length === 1 ? elements[0] : elements;
}
})(jQuery);
var str = "", i = 10000; while(i){ str += Math.random() > .5 ? "1" : "0"; i--; }; str
@teddykishi
teddykishi / ex1-prototype-style.js
Created March 8, 2016 23:42 — forked from getify/ex1-prototype-style.js
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);
@teddykishi
teddykishi / Drag and Drop in Phaser.markdown
Created April 18, 2016 14:07
Drag and Drop in Phaser
@teddykishi
teddykishi / Phaser Coding Tips 3 (Platforms).markdown
Created April 18, 2016 14:07
Phaser Coding Tips 3 (Platforms)
@teddykishi
teddykishi / Olives – a Phaser FruitNinja test.markdown
Created April 18, 2016 14:08
Olives – a Phaser FruitNinja test

Phaser Jump Game

This is a demo that goes along with a forum reply here: http://www.html5gamedevs.com/topic/7369-infinite-world/

Working with a potentially infinite world size can be tricky with Phaser. This method seems to work well though. As you move up, the camera follows the hero. Then, based on how high the hero has reached in comparison to where they started, that offset and height is modified on the world bounds. This allows the world to expand to the exact height that the game requires, all the while using the built in physics system without any trickery for the platforms to work. The player is moving up in world space, while the platforms keep their same coordinates, so it is easier to wrap your head around.

A Pen by Jack Rugile on CodePen.

License.

THE CONFETTI ANIMATION

Smooth, sleek, responsive and retina ready confetti animation effect. There are two types of confetti, the traditional pieces of ‘paper’ and a ribbon type that wiggles its way down the screen. The ribbon confetti uses a physics simulation for the motion while the paper confetti is animated using sine functions.

A Pen by Hemn Chawroka on CodePen.

License.