Skip to content

Commit

Permalink
fix: fixed some textures and physics
Browse files Browse the repository at this point in the history
  • Loading branch information
201flaviosilva committed Aug 25, 2022
1 parent b020142 commit 8426568
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 58 deletions.

This file was deleted.

Binary file not shown.
Binary file added src/Assets/Img/Sprites/Enemy/Duke/DukeLeft.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
3 changes: 3 additions & 0 deletions src/Assets/Img/Sprites/Web/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Web

https://www.pixilart.com/art/web-logo-sr2512b3809adb0
Binary file added src/Assets/Img/Sprites/Web/Web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions src/Objects/CalcadaPortuguesa.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/Objects/Home/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import GlobalConfigs from '../../Configs';

export default class Player extends Phaser.Physics.Arcade.Sprite {
constructor(scene, x, y) {
super(scene, x, y, "Sprite");
super(scene, x, y, "DukeLeft");

this.keys = this.scene.input.keyboard.addKeys(GlobalConfigs.controllers.start);

Expand Down
60 changes: 49 additions & 11 deletions src/Scenes/GamePlay/Pascal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import GlobalConfigs from "../../Configs";

import AnimateTitle from "../../Components/AnimatedTitle";
import Button from "../../Components/Button";
import DebugFPS from "../../Components/DebugFPS";

import Duke from "../../Objects/Platform/Duke";
import Player from "../../Objects/Platform/Player";
Expand All @@ -16,7 +18,17 @@ const SCENE_WIDTH = 7000;

export default class Pascal extends Phaser.Scene {
constructor() {
super({ key: "Pascal" });
const config = {
key: "Pascal",
physics: {
default: "arcade",
arcade: {
debug: GlobalConfigs.debug,
gravity: { x: 0, y: 200, },
},
},
};
super(config);
}

init() {
Expand All @@ -30,17 +42,19 @@ export default class Pascal extends Phaser.Scene {
this.createPlayer();
this.createCollision();

GlobalConfigs.debug && this.createDebug();

// { // Debug
// const graphics = this.add.graphics().setDepth(0);
// graphics.lineStyle(1, 0xff0000, 1);
// for (let i = 0; i < SCENE_WIDTH / 500; i++) {
// const x = i * 500;
// graphics.lineBetween(x, 0, x, GlobalConfigs.screen.height);
// this.add.text(x, 0, x, { fill: "black" });
// }
// }
this.scene.launch("PascalUI");
}

createDebug() {
const graphics = this.add.graphics().setDepth(0);
graphics.lineStyle(1, 0xff0000, 1);
for (let i = 0; i < SCENE_WIDTH / 500; i++) {
const x = i * 500;
graphics.lineBetween(x, 0, x, GlobalConfigs.screen.height);
this.add.text(x, 0, x, { fill: "black" });
}
}

createWorld() {
Expand All @@ -52,7 +66,7 @@ export default class Pascal extends Phaser.Scene {
const background = this.add.image(middleWidth, middleHeight, "BackgroundForest").setScale(1.3, 1);
background.setScrollFactor(0);

// UI
// Title
new AnimateTitle(this, middleWidth, 100, "Pascal");
}

Expand Down Expand Up @@ -335,3 +349,27 @@ export default class Pascal extends Phaser.Scene {
if (duke3_7) duke3_7.generate();
}
}

export class PascalUI extends Phaser.Scene {
constructor() {
super({ key: "PascalUI" });
}

create() {
GlobalConfigs.debug && new DebugFPS(this);

this.exitButton = new Button(this, {
x: this.scale.width - 50,
y: 50,
up: 1,
down: 0,
over: 1,
text: "Exit",
upCallback: () => {
this.scene.stop("Pascal");
this.scene.start("Start");
this.scene.stop("PascalUI");
}
}).setScale(0.25);
}
}
7 changes: 0 additions & 7 deletions src/Scenes/GamePlay/SnakeAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ export default class SnakeAll extends Phaser.Scene {
width: 1280, // 40*32
height: 704, // 22*32
},
physics: {
default: "arcade",
arcade: {
gravity: { x: 0, y: 0, },
debug: GlobalConfigs.debug,
},
},
};
super(config);
}
Expand Down
11 changes: 1 addition & 10 deletions src/Scenes/GamePlay/Web.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ const EventSystem = new Phaser.Events.EventEmitter();

export default class Web extends Phaser.Scene {
constructor() {
const config = {
key: "Web",
physics: {
default: "arcade",
arcade: {
gravity: { x: 0, y: 0, },
debug: GlobalConfigs.debug,
},
},
};
const config = { key: "Web", };
super(config);
}

Expand Down
12 changes: 11 additions & 1 deletion src/Scenes/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ import DirectionSign from "../Objects/DirectionSign";

export default class Options extends Phaser.Scene {
constructor() {
super({ key: "Options" });
const config = {
key: "Options",
physics: {
default: "arcade",
arcade: {
gravity: { x: 0, y: 200, },
debug: GlobalConfigs.debug,
},
},
};
super(config);
}

create() {
Expand Down
10 changes: 6 additions & 4 deletions src/Scenes/Preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import Pascal from "../Assets/Img/Sprites/Languages/Pascal/Pascal.png";
import SASS from "../Assets/Img/Sprites/Languages/SASS/SASS.png";
import VisualBasic from "../Assets/Img/Sprites/Languages/VisualBasic/VisualBasic.png";

import Web from "../Assets/Img/Sprites/Web/Web.png";

// -- Enemy --
import Duke from "../Assets/Img/Sprites/Enemy/Duke/Duke.png";
import DukeLeft from "../Assets/Img/Sprites/Enemy/Duke/DukeLeft.png";

// -- Sprite --
import Sprite from "../Assets/Img/Sprites/Sprite.png";
Expand Down Expand Up @@ -55,8 +58,6 @@ import BGForest from "../Assets/Img/Sprites/PlatformerBundle/BG/BG.png";
// -- Tiles (SpriteSheet) --
import Tiles from "../Assets/Img/Sprites/PlatformerBundle/Tiles/SpriteSheet/Tiles.png";
import SkyTiles from "../Assets/Img/Sprites/PlatformerBundle/Tiles/SpriteSheet/SkyTiles.png";
import CalcadaPortuguesaTexture from "../Assets/Img/Sprites/CalcadaPortuguesaTexture/CalcadaPortuguesaTexture.png";


// ---- UI ----
import StarsBackground from "../Assets/Img/UI/Background/StarsBackground.png";
Expand Down Expand Up @@ -106,8 +107,11 @@ export default class Preload extends Phaser.Scene {
this.load.image("SASS", SASS);
this.load.image("VisualBasic", VisualBasic);

this.load.image("Web", Web);

// - Enemy
this.load.image("Duke", Duke);
this.load.image("DukeLeft", DukeLeft);

this.load.image("Sprite", Sprite);
this.load.spritesheet("SquaresParticles", SquaresParticles, { frameWidth: 32, frameHeight: 32 });
Expand Down Expand Up @@ -139,8 +143,6 @@ export default class Preload extends Phaser.Scene {

this.load.spritesheet("Tiles", Tiles, { frameWidth: 128, frameHeight: 128 });
this.load.spritesheet("SkyTiles", SkyTiles, { frameWidth: 128, frameHeight: 93 });

this.load.spritesheet("CalcadaPortuguesa", CalcadaPortuguesaTexture, { frameWidth: 128, frameHeight: 128 });
}

importUI() {
Expand Down
15 changes: 2 additions & 13 deletions src/Scenes/Start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@ import Player from "../Objects/Home/Player";

export default class Start extends Phaser.Scene {
constructor() {
const config = {
key: "Start",
active: false,
physics: {
default: "arcade",
arcade: {
gravity: { x: 0, y: 0, },
debug: GlobalConfigs.debug,
},
},
};
super(config);
super({ key: "Start", });
}

create() {
Expand Down Expand Up @@ -46,7 +35,7 @@ export default class Start extends Phaser.Scene {
}

{ // Web
const web = this.physics.add.image(middleWidth - 350, middleHeight + 100, "Web").setScale(4, 2);
const web = this.physics.add.image(middleWidth - 350, middleHeight + 100, "Web").setScale(4);
this.physics.add.collider(this.player, web, () => { this.scene.start("Web"); });
}

Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Preload from "./Scenes/Preload";
import Index from "./Scenes/Index";
import Start from "./Scenes/Start";
import Options from "./Scenes/Options";
import Pascal from "./Scenes/GamePlay/Pascal";
import Pascal, { PascalUI } from "./Scenes/GamePlay/Pascal";
import SnakeAll, { SnakeAllUI } from "./Scenes/GamePlay/SnakeAll";
import Web, { WebUI } from "./Scenes/GamePlay/Web";

Expand Down Expand Up @@ -48,7 +48,7 @@ const config = {
default: "arcade",
arcade: {
debug: GlobalConfigs.debug,
gravity: { x: 0, y: 200 }
gravity: { x: 0, y: 0 }
}
},
scene: [
Expand All @@ -57,7 +57,7 @@ const config = {
Start,
Options,
// Game Play
Pascal,
Pascal, PascalUI,
SnakeAll, SnakeAllUI,
Web, WebUI,
],
Expand Down

0 comments on commit 8426568

Please sign in to comment.