Example of Drag and Drop in Phaser
A Pen by Juan David Nicholls Cardona on CodePen.
<!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; |
(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 |
function Foo(who) { | |
this.me = who; | |
} | |
Foo.prototype.identify = function() { | |
return "I am " + this.me; | |
}; | |
function Bar(who) { | |
Foo.call(this,"Bar:" + who); |
Example of Drag and Drop in Phaser
A Pen by Juan David Nicholls Cardona on CodePen.
This is the platforms code from Phaser Coding Tips 3
A Pen by Richard Davey on CodePen.
Simple fruit ninja clone with phaser
A Pen by Aaron Buchanan on CodePen.
Tween timeline in Phaser
A Pen by Juan David Nicholls Cardona on CodePen.
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.
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.