Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion public/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -44539,6 +44539,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
var app = new PIXI.Application({
backgroundColor: 0x00FFFF
});
var hasTouchedGround = false;
var loader = new PIXI.Loader();
document.getElementById("pixi").appendChild(app.view);
var paw = PIXI.Sprite.from('images/cat.png');
Expand Down Expand Up @@ -44580,6 +44581,7 @@ bgPic.tilePosition.y = 0;
app.stage.addChild(bgPic);

function resetPaw() {
hasTouchedGround = false;
paw.x = app.screen.width / 2;
paw.y = app.screen.height / 2;
paw.vx = 0;
Expand All @@ -44591,6 +44593,7 @@ function resetPaw() {
}

function resetDog() {
hasTouchedGround = false;
dog.x = app.screen.width / 2;
dog.y = app.screen.height / 2;
dog.vx = 0;
Expand Down Expand Up @@ -44695,9 +44698,13 @@ app.ticker.add(function (delta) {
addTurtle();
}

if (activeChar.y === app.screen.height - 62) {
hasTouchedGround = true;
}

turtle.x += turtle.vx;

if (up.isDown && count < 45 && fallDone) {
if (up.isDown && count < 45 && fallDone && hasTouchedGround) {
activeChar.vy = -2;
count++;
} else {
Expand Down
8 changes: 7 additions & 1 deletion public/pixiBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as PIXI from 'pixi.js';

//init basics
let app = new PIXI.Application({ backgroundColor: 0x00FFFF});
let hasTouchedGround = false;
const loader = new PIXI.Loader();
document.getElementById("pixi").appendChild(app.view);
let paw = PIXI.Sprite.from('images/cat.png');
Expand Down Expand Up @@ -36,6 +37,7 @@ bgPic.tilePosition.y = 0;
app.stage.addChild(bgPic);

function resetPaw() {
hasTouchedGround = false;
paw.x = app.screen.width / 2;
paw.y = app.screen.height / 2;
paw.vx = 0;
Expand All @@ -47,6 +49,7 @@ function resetPaw() {
}

function resetDog() {
hasTouchedGround = false;
dog.x = app.screen.width / 2;
dog.y = app.screen.height / 2;
dog.vx = 0;
Expand Down Expand Up @@ -147,8 +150,11 @@ app.ticker.add(function(delta) {
if(time % 8 === 0){
addTurtle();
}
if (activeChar.y === app.screen.height - 62) {
hasTouchedGround = true;
}
turtle.x += turtle.vx;
if (up.isDown && count < 45 && fallDone) {
if (up.isDown && count < 45 && fallDone && hasTouchedGround) {
activeChar.vy = -2;
count++;
} else {
Expand Down