Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwon-mun committed Jul 31, 2024
0 parents commit 657ca70
Show file tree
Hide file tree
Showing 40 changed files with 2,746 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# polaris
Binary file added assets/_item1.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/_item3.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/_item4.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/another.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/another_2.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/another_3.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/another_final.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/another_finalll.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/background.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/bg.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/bg_gray.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/dude2.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/dude3.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/ground_h.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/ground_v.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/item1.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/item2.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/item3.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/item4.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/item5.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/item6.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/item7.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/item8.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/jump.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/kneel.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/me.png
Binary file added assets/o.png
122 changes: 122 additions & 0 deletions assets/part7.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Making your first Phaser 3 Game - Part 7</title>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
<style type="text/css">
body {
margin: 0;
}
</style>
</head>
<body>

<script type="text/javascript">

var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 300 },
debug: false
}
},
scene: {
preload: preload,
create: create,
update: update
}
};

var player;
var platforms;
var cursors;

var game = new Phaser.Game(config);

function preload ()
{
this.load.image('sky', 'assets/sky.png');
this.load.image('ground', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
this.load.image('bomb', 'assets/bomb.png');
this.load.spritesheet('dude', 'assets/dude.png', { frameWidth: 32, frameHeight: 48 });
}

function create ()
{
this.add.image(400, 300, 'sky');

platforms = this.physics.add.staticGroup();

platforms.create(400, 568, 'ground').setScale(2).refreshBody();

platforms.create(600, 400, 'ground');
platforms.create(50, 250, 'ground');
platforms.create(750, 220, 'ground');

player = this.physics.add.sprite(100, 450, 'dude');

player.setBounce(0.2);
player.setCollideWorldBounds(true);

this.anims.create({
key: 'left',
frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }),
frameRate: 10,
repeat: -1
});

this.anims.create({
key: 'turn',
frames: [ { key: 'dude', frame: 4 } ],
frameRate: 20
});

this.anims.create({
key: 'right',
frames: this.anims.generateFrameNumbers('dude', { start: 5, end: 8 }),
frameRate: 10,
repeat: -1
});

cursors = this.input.keyboard.createCursorKeys();

this.physics.add.collider(player, platforms);
}

function update ()
{
if (cursors.left.isDown)
{
player.setVelocityX(-160);

player.anims.play('left', true);
}
else if (cursors.right.isDown)
{
player.setVelocityX(160);

player.anims.play('right', true);
}
else
{
player.setVelocityX(0);

player.anims.play('turn');
}

if (cursors.up.isDown && player.body.touching.down)
{
player.setVelocityY(-330);
}
}

</script>

</body>
</html>
Binary file added assets/polaris.png
Binary file added assets/polaris_shadow.png
Binary file added assets/q.png
Binary file added assets/reload.png
Binary file added assets/right_arrow.png
Binary file added assets/run.png
Binary file added assets/title.png
Binary file added assets/trampolin.png
Binary file added assets/x.png
73 changes: 73 additions & 0 deletions mobile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
class Example extends Phaser.Scene {
create() {
const graphics = this.add.graphics();
const outer_graphics = this.add.graphics();
const color = 0xffff00;
const thickness = 2;
const alpha = 1;

let xCursor,
yCursor = 0;

// Events

let draw = false;

this.input.on("pointerdown", (pointer) => {
const black = 0xc0c0c0;

xCursor = pointer.downX;
yCursor = pointer.downY;

outer_graphics.fillStyle(black);
outer_graphics.fillCircle(pointer.downX, pointer.downY, 60);
outer_graphics.setDepth(-1);

const gray = 0x808080;
graphics.fillStyle(gray);
graphics.fillCircle(pointer.downX, pointer.downY, 30);

graphics.setDepth(1);

draw = true;
});

this.input.on("pointerup", () => {
outer_graphics.clear();
graphics.clear();
draw = false;
});

this.input.on("pointermove", (pointer) => {
if (draw) {
const dx = pointer.x - xCursor;
const dy = pointer.y - yCursor;
const distance = Math.sqrt(dx * dx + dy * dy);

if (distance + 30 > 50) {
// Calculate the angle to the pointer
const angle = Math.atan2(dy, dx);
// Position the gray circle within the black circle's radius
pointer.x = xCursor + (50 - 30) * Math.cos(angle);
pointer.y = yCursor + (50 - 30) * Math.sin(angle);
}

graphics.setDepth(1);
graphics.clear();
const gray = 0x808080;
graphics.fillStyle(gray);
graphics.fillCircle(pointer.x, pointer.y, 30);
}
});
}
}

const config = {
type: Phaser.AUTO,
parent: "phaser-example",
width: 800,
height: 600,
scene: Example,
};

const game = new Phaser.Game(config);
Loading

0 comments on commit 657ca70

Please sign in to comment.