Added login bg img
This commit is contained in:
parent
169ea9e0fd
commit
8234981968
BIN
public/assets/Leaf_BG_standalone.png
Normal file
BIN
public/assets/Leaf_BG_standalone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 867 KiB |
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Game />
|
<Login />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -3,29 +3,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Circle, Image, useGame, useScene } from 'phavuer'
|
import { Image, useScene } from 'phavuer'
|
||||||
import 'phaser';
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const scene = useScene()
|
const scene = useScene()
|
||||||
|
|
||||||
const props = defineProps({
|
let x = ref(0)
|
||||||
x: Number,
|
let y = ref(0)
|
||||||
y: Number,
|
|
||||||
moving: Boolean,
|
|
||||||
direction: String,
|
|
||||||
speed: Number,
|
|
||||||
})
|
|
||||||
|
|
||||||
// set x and y
|
|
||||||
let x = props.x
|
|
||||||
let y = props.y
|
|
||||||
x = 100
|
|
||||||
y = 100
|
|
||||||
|
|
||||||
// on press "W" move up
|
// on press "W" move up
|
||||||
scene.input.keyboard.on('keydown_W', () => {
|
const keyObj = scene.input.keyboard.addKey('W');
|
||||||
y -= 10
|
var isDown = keyObj.isDown;
|
||||||
console.log(y);
|
var isUp = keyObj.isUp;
|
||||||
})
|
console.log(isDown, isUp)
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -1,23 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<audio ref="bgm" id="bgm" src="@/assets/sound/bgm.mp3" loop autoplay></audio>
|
<audio ref="bgm" id="bgm" src="/assets/sound/bgm.mp3" loop autoplay></audio>
|
||||||
|
<img src="/assets/Leaf_BG_standalone.png" class="bg-img" alt="login bg" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
|
||||||
const bgm = ref(null)
|
|
||||||
const bgmStart = () => bgm.value.play();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// check if bgm is playing already and do nothing
|
|
||||||
if (bgm.value.paused) {
|
|
||||||
window.addEventListener('click', () => bgm.value.play())
|
|
||||||
window.addEventListener('keydown', () => bgm.value.play())
|
|
||||||
window.addEventListener('mousemove', () => bgm.value.play())
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.bg-img {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user