Skip to content

Commit

Permalink
Add item Hang Glider
Browse files Browse the repository at this point in the history
  • Loading branch information
diguifi committed Feb 27, 2019
1 parent 35d3814 commit f04bfea
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 63 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dude's Quest
# Dude's Quest
[![CodeFactor](https://www.codefactor.io/repository/github/diguifi/dude-sidescroll/badge/master)](https://www.codefactor.io/repository/github/diguifi/dude-sidescroll/overview/master)
![GitHub last commit](https://img.shields.io/github/last-commit/diguifi/Dude-SideScroll.svg?style=popout)
![GitHub stars](https://img.shields.io/github/stars/diguifi/Dude-SideScroll.svg?style=popout)
Expand All @@ -8,6 +8,7 @@
</p>

# [Play!](https://diguifi.github.io/Dude-SideScroll)
_(not fully supported on Edge)_

A side-scrolling adventure game, featuring Dude, from [Adventures of Dude in the Top-Down world](https://github.com/diguifi/Dude-TopDown).

Expand Down Expand Up @@ -37,8 +38,7 @@ This game was created using [Phaser 2](https://phaser.io/) and written in [TypeS
- ~Music and sound effects~
- ~Main menu~
- ~Some item(s)~
- 10 levels
- ...
- ~Demo with 4 levels~

## Art
[Jesse M - Jungle Pack](https://jesse-m.itch.io/jungle-pack)
Expand Down
48 changes: 24 additions & 24 deletions assets/levels/jungle1.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"name":"misc",
"objects":[
{
"gid":757,
"gid":760,
"height":32,
"id":38,
"name":"lumpofgrass",
Expand Down Expand Up @@ -65,7 +65,7 @@
"name":"gems",
"objects":[
{
"gid":743,
"gid":746,
"height":16,
"id":15,
"name":"gem1",
Expand All @@ -77,7 +77,7 @@
"y":78
},
{
"gid":743,
"gid":746,
"height":16,
"id":16,
"name":"gem1",
Expand All @@ -89,7 +89,7 @@
"y":78.6666666666667
},
{
"gid":743,
"gid":746,
"height":16,
"id":17,
"name":"gem1",
Expand All @@ -101,7 +101,7 @@
"y":108
},
{
"gid":743,
"gid":746,
"height":16,
"id":18,
"name":"gem1",
Expand All @@ -113,7 +113,7 @@
"y":142
},
{
"gid":743,
"gid":746,
"height":16,
"id":19,
"name":"gem1",
Expand All @@ -125,7 +125,7 @@
"y":141
},
{
"gid":743,
"gid":746,
"height":16,
"id":20,
"name":"gem1",
Expand All @@ -137,7 +137,7 @@
"y":141
},
{
"gid":743,
"gid":746,
"height":16,
"id":21,
"name":"gem1",
Expand All @@ -149,7 +149,7 @@
"y":78
},
{
"gid":743,
"gid":746,
"height":16,
"id":22,
"name":"gem1",
Expand All @@ -161,7 +161,7 @@
"y":168.333333333333
},
{
"gid":743,
"gid":746,
"height":16,
"id":23,
"name":"gem1",
Expand All @@ -173,7 +173,7 @@
"y":93
},
{
"gid":743,
"gid":746,
"height":16,
"id":26,
"name":"gem1",
Expand Down Expand Up @@ -303,7 +303,7 @@
"name":"redgems",
"objects":[
{
"gid":747,
"gid":750,
"height":16,
"id":28,
"name":"redgem",
Expand All @@ -321,10 +321,10 @@
"y":0
}],
"nextlayerid":8,
"nextobjectid":51,
"nextobjectid":52,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.2.1",
"tiledversion":"1.2.2",
"tileheight":16,
"tilesets":[
{
Expand All @@ -341,21 +341,21 @@
"tilewidth":16
},
{
"columns":1,
"columns":4,
"firstgid":742,
"image":"..\/sprites\/enemy.png",
"imageheight":22,
"imagewidth":23,
"imagewidth":105,
"margin":0,
"name":"enemies",
"spacing":0,
"tilecount":1,
"tilecount":4,
"tileheight":22,
"tilewidth":23
},
{
"columns":4,
"firstgid":743,
"firstgid":746,
"image":"..\/sprites\/itens\/spr_coin_cin.png",
"imageheight":16,
"imagewidth":64,
Expand All @@ -368,7 +368,7 @@
},
{
"columns":4,
"firstgid":747,
"firstgid":750,
"image":"..\/sprites\/itens\/spr_coin_ver.png",
"imageheight":16,
"imagewidth":64,
Expand All @@ -381,7 +381,7 @@
},
{
"columns":6,
"firstgid":751,
"firstgid":754,
"image":"..\/sprites\/shield.png",
"imageheight":17,
"imagewidth":96,
Expand All @@ -394,7 +394,7 @@
},
{
"columns":1,
"firstgid":757,
"firstgid":760,
"image":"..\/sprites\/lumpofgrass.png",
"imageheight":32,
"imagewidth":32,
Expand All @@ -407,7 +407,7 @@
},
{
"columns":2,
"firstgid":758,
"firstgid":761,
"image":"..\/sprites\/platform.png",
"imageheight":8,
"imagewidth":64,
Expand All @@ -420,7 +420,7 @@
},
{
"columns":2,
"firstgid":760,
"firstgid":763,
"image":"..\/sprites\/lever.png",
"imageheight":16,
"imagewidth":32,
Expand All @@ -433,7 +433,7 @@
},
{
"columns":1,
"firstgid":762,
"firstgid":765,
"image":"..\/sprites\/gate.png",
"imageheight":48,
"imagewidth":16,
Expand Down
57 changes: 41 additions & 16 deletions assets/levels/jungle4.json

Large diffs are not rendered by default.

Binary file modified assets/sprites/dude_spritesheet.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/sprites/hangglider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/game.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion scripts/Preloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Preloader extends Phaser.State {
ready: boolean = false;

preload() {
this.game.load.spritesheet('dude', 'assets/sprites/dude_spritesheet.png?v=1', 16, 25, 8);
this.game.load.spritesheet('dude', 'assets/sprites/dude_spritesheet.png?v=1', 16, 25, 9);
this.game.load.spritesheet('enemy1', 'assets/sprites/enemy.png?v=1', 21, 22, 5);
this.game.load.spritesheet('bat', 'assets/sprites/bat_spritesheet.png?v=1', 16, 16, 10);

Expand All @@ -18,6 +18,7 @@ export class Preloader extends Phaser.State {
this.game.load.spritesheet('platform', 'assets/sprites/platform.png?v=1', 32, 8, 2);
this.game.load.spritesheet('lever', 'assets/sprites/lever.png', 16, 16, 2);
this.game.load.image('heart', 'assets/sprites/itens/heart.png');
this.game.load.image('hangglider', 'assets/sprites/hangglider.png');
this.game.load.image('gate', 'assets/sprites/gate.png');
this.game.load.image('lumpofgrass', 'assets/sprites/lumpofgrass.png');

Expand Down
37 changes: 37 additions & 0 deletions scripts/elements/items/HangGlider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export class HangGlider extends Phaser.Sprite {
game: Phaser.Game;
size: number;
caught: boolean = false;
name: string = 'hangglider';

constructor(game: Phaser.Game, x: number, y: number, gravity: number) {
super(game, x, y, 'hangglider', 0);
this.game = game;

// sprite size
this.size = 2;
this.scale.setTo(this.size, this.size);

// sprite anchor
this.anchor.setTo(0.5, 0);

// physics
this.game.physics.arcade.enableBody(this);
this.body.setSize(30, 26, 0, 0);
this.body.collideWorldBounds = true;
this.body.gravity.y = gravity;

game.add.existing(this);
}

update() {
if (this.caught) {
this.body.enable = false;
this.visible = false;
}
else {
this.body.enable = true;
this.visible = true;
}
}
}
Loading

0 comments on commit f04bfea

Please sign in to comment.