Skip to content

Commit

Permalink
added hoverboard sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik committed Jun 21, 2015
1 parent 817331a commit 5a7b160
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Binary file added assets/hoverboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/hoverboard_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion assets/sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ bananas5.png http://cliparts.co/clipart/16657
grass.png http://per-ankh.deviantart.com/art/MapleStory-Grass-Tile-423960012
giraffe.png http://www.clipartpanda.com/clipart_images/animals-clip-art-page-12-36637335
archway.svg http://www.clipshrine.com/archway-arch-road-11417-medium.html
torch.png http://clubpenguin.wikia.com/wiki/File:Wall_Torch.PNG
torch.png http://clubpenguin.wikia.com/wiki/File:Wall_Torch.PNG
hoverboard.png http://myfirstworld.com/profile.asp?user=279967
16 changes: 11 additions & 5 deletions hungrymonkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ var sprites = {
giraffe: {w: 335, h: 421, file: "giraffe.png"},
archway: {w: 47, h: 110, file: "archway.svg", map: {sprite_archway_left:[0,0],
sprite_archway_right:[1,0]}},
torch: {w: 47, h: 100, file: "torch.png"}
torch: {w: 47, h: 100, file: "torch.png"},
hoverboard: {w: 200, h: 50, file: "hoverboard_horizontal.png"}
};

Object.keys(sprites).forEach(function(spriteKey) {
Expand Down Expand Up @@ -308,10 +309,16 @@ function buildArchway(levelWidth) {

function placeHoverboard(x, monkey) {
var h = 20;
var hoverboard = Crafty.e('2D, DOM, Color, Floor, Motion')

var hoverboard_sprite = Crafty.e('2D, DOM, sprite_hoverboard')
.attr({x: x, y: H-FH-h-20, z: 8,
w: 100, h: h})
.color('#FF5677');
w: 100, h: h});

var hoverboard = Crafty.e('2D, Floor, Motion')
.attr({x: x, y: H-FH-h-5, z: 8,
w: 100, h: h});
hoverboard.attach(hoverboard_sprite);

var normalSpeed = monkey._speed;
var hbSpeed = normalSpeed.x*1.5;
var hoverboardSpeed = {x: hbSpeed, y: hbSpeed};
Expand All @@ -324,7 +331,6 @@ function placeHoverboard(x, monkey) {
// TODO maybe use enterframe
var iv = setInterval(function(){
hoverboard.vx /= 1.5;
console.log("dsd");
if (Math.abs(hoverboard.vx) < 0.01) {
clearInterval(iv);
}
Expand Down

0 comments on commit 5a7b160

Please sign in to comment.