commit bcf20226f45fc8c77e838239df5d91aab1d09947 Author: Brian Fertig Date: Sat Jul 12 21:31:32 2025 -0600 first commit diff --git a/assets/background.png b/assets/background.png new file mode 100644 index 0000000..6aa8ba3 Binary files /dev/null and b/assets/background.png differ diff --git a/assets/bricks.png b/assets/bricks.png new file mode 100644 index 0000000..26ca77a Binary files /dev/null and b/assets/bricks.png differ diff --git a/assets/original/ComfyUI_temp_gpqgr_00006_.png b/assets/original/ComfyUI_temp_gpqgr_00006_.png new file mode 100644 index 0000000..d2feb57 Binary files /dev/null and b/assets/original/ComfyUI_temp_gpqgr_00006_.png differ diff --git a/assets/original/battle_duck.png b/assets/original/battle_duck.png new file mode 100644 index 0000000..70cc63a Binary files /dev/null and b/assets/original/battle_duck.png differ diff --git a/assets/original/battle_duck_jump.png b/assets/original/battle_duck_jump.png new file mode 100644 index 0000000..70f2830 Binary files /dev/null and b/assets/original/battle_duck_jump.png differ diff --git a/assets/pee_test.png b/assets/pee_test.png new file mode 100644 index 0000000..bbc0f71 Binary files /dev/null and b/assets/pee_test.png differ diff --git a/assets/platform.png b/assets/platform.png new file mode 100644 index 0000000..4e4916c Binary files /dev/null and b/assets/platform.png differ diff --git a/assets/platform2.png b/assets/platform2.png new file mode 100644 index 0000000..55a1da2 Binary files /dev/null and b/assets/platform2.png differ diff --git a/assets/platforms.png b/assets/platforms.png new file mode 100644 index 0000000..5ff02a1 Binary files /dev/null and b/assets/platforms.png differ diff --git a/assets/player.png b/assets/player.png new file mode 100644 index 0000000..63ffc44 Binary files /dev/null and b/assets/player.png differ diff --git a/assets/player2.png b/assets/player2.png new file mode 100644 index 0000000..088032c Binary files /dev/null and b/assets/player2.png differ diff --git a/assets/player_duck.png b/assets/player_duck.png new file mode 100644 index 0000000..1baeb7f Binary files /dev/null and b/assets/player_duck.png differ diff --git a/assets/player_duck_jump.png b/assets/player_duck_jump.png new file mode 100644 index 0000000..18d85dc Binary files /dev/null and b/assets/player_duck_jump.png differ diff --git a/assets/player_jump.png b/assets/player_jump.png new file mode 100644 index 0000000..52d2674 Binary files /dev/null and b/assets/player_jump.png differ diff --git a/game.js b/game.js new file mode 100644 index 0000000..b6a6f3d --- /dev/null +++ b/game.js @@ -0,0 +1,112 @@ +const config = { + type: Phaser.AUTO, + width: 1280, + height: 800, + physics: { + default: 'arcade', + arcade: { + gravity: { y: 300 }, + debug: false + } + }, + scene: { + preload: preload, + create: create, + update: update + } +}; + +const game = new Phaser.Game(config); + +function preload() { + this.load.image('background', 'assets/background.png'); + this.load.image('ground', 'assets/platforms.png'); + this.load.image('player', 'assets/player.png'); + this.load.image('player2', 'assets/player2.png'); + this.load.image('player_jump', 'assets/player_jump.png'); + this.load.image('bricks', 'assets/bricks.png'); + this.load.image('pee', 'assets/pee_test.png'); + + //Create an animation for walking left + this.anims.create({ + key: 'walkLeft', + frames: [ + { key: 'player'}, + { key: 'player2' } + ] + }); +} + +let player, cursors, ground, platforms; + + +function create() { + // Add background image + const background = this.add.image(0, 0, 'background').setOrigin(0, 0); + background.scaleX = this.scale.width / background.width; + background.scaleY = this.scale.height / background.height; + + // Create ground + platforms = this.physics.add.staticGroup(); + platforms.create(650, 750, 'ground') + .setOffset(0, 50); + + // Add Bricks + platforms.create(600, 600, 'bricks').setScale(.5).refreshBody(); + platforms.create(1100, 400, 'bricks').setScale(.5).refreshBody(); + platforms.create(900, 250, 'bricks').setScale(.5).refreshBody(); + + // Add Platforms + platforms.create(1200, 500, 'ground') + .setScale(.5) + .refreshBody() + .setSize(1296/2, 50) + .setOffset(0, 25); + platforms.create(350, 300, 'ground') + .setScale(.5) + .refreshBody() + .setSize(1296/2, 50) + .setOffset(0, 25); + + platforms.create(100, 250, 'pee') + .setScale(.10) + .refreshBody(); + + // Create player + player = this.physics.add.sprite(200, 450, 'player'); + player.setBounce(0.2); + player.setSize(100, 140); + player.setOffset(30, 4); + player.setCollideWorldBounds(true); + + // Add controls + cursors = this.input.keyboard.createCursorKeys(); + + // Add collision and sound + this.physics.add.collider(player, platforms); + //this.sound.add('jump', { volume: 0.5 }); +} + +function update() { + if (cursors.left.isDown) { + player.setVelocityX(-160); + player.setFlipX(false); + //player.anims.play('walkLeft', true); // Play walking animation + } else if (cursors.right.isDown) { + player.setVelocityX(160); + player.setFlipX(true); + } else { + player.setVelocityX(0); + } + + if (cursors.up.isDown && player.body.touching.down) { + player.setVelocityY(-330); + } + + if (player.body.velocity.y > -1) { + player.setTexture('player'); // Change texture back to normal when touching the ground + } else { + player.setTexture('player_jump'); // Change texture to jump + } + +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..e387d4b --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + My Platformer Game + + + + + + + \ No newline at end of file