mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-04 09:48:11 +09:00
tweak game
This commit is contained in:
parent
a0976772b3
commit
4ea030d669
@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader/></template>
|
<template #header><MkPageHeader/></template>
|
||||||
<MkSpacer :contentMax="800">
|
<MkSpacer :contentMax="800">
|
||||||
<div class="_gaps_s" :class="$style.root" style="margin: 0 auto;" :style="{ maxWidth: GAME_WIDTH + 'px' }">
|
<div class="_gaps_s" :class="$style.root" style="margin: 0 auto; max-width: 600px;">
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<div :class="$style.frame" style="flex: 1; margin-right: 10px;">
|
<div :class="$style.frame" style="flex: 1; margin-right: 10px;">
|
||||||
<div :class="$style.frameInner">
|
<div :class="$style.frameInner">
|
||||||
@ -221,10 +221,10 @@ class Game extends EventEmitter<{
|
|||||||
private COMBO_INTERVAL = 1000;
|
private COMBO_INTERVAL = 1000;
|
||||||
public readonly DROP_INTERVAL = 500;
|
public readonly DROP_INTERVAL = 500;
|
||||||
private PLAYAREA_MARGIN = 25;
|
private PLAYAREA_MARGIN = 25;
|
||||||
|
private STOCK_MAX = 4;
|
||||||
private engine: Matter.Engine;
|
private engine: Matter.Engine;
|
||||||
private render: Matter.Render;
|
private render: Matter.Render;
|
||||||
private runner: Matter.Runner;
|
private runner: Matter.Runner;
|
||||||
private detector: Matter.Detector;
|
|
||||||
private overflowCollider: Matter.Body;
|
private overflowCollider: Matter.Body;
|
||||||
private isGameOver = false;
|
private isGameOver = false;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ class Game extends EventEmitter<{
|
|||||||
wireframeBackground: 'transparent', // transparent to hide
|
wireframeBackground: 'transparent', // transparent to hide
|
||||||
wireframes: false,
|
wireframes: false,
|
||||||
showSleeping: false,
|
showSleeping: false,
|
||||||
pixelRatio: window.devicePixelRatio,
|
pixelRatio: Math.max(2, window.devicePixelRatio),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -295,8 +295,6 @@ class Game extends EventEmitter<{
|
|||||||
this.runner = Matter.Runner.create();
|
this.runner = Matter.Runner.create();
|
||||||
Matter.Runner.run(this.runner, this.engine);
|
Matter.Runner.run(this.runner, this.engine);
|
||||||
|
|
||||||
this.detector = Matter.Detector.create();
|
|
||||||
|
|
||||||
this.engine.world.bodies = [];
|
this.engine.world.bodies = [];
|
||||||
|
|
||||||
//#region walls
|
//#region walls
|
||||||
@ -412,7 +410,7 @@ class Game extends EventEmitter<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public start() {
|
public start() {
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < this.STOCK_MAX; i++) {
|
||||||
this.stock.push({
|
this.stock.push({
|
||||||
id: Math.random().toString(),
|
id: Math.random().toString(),
|
||||||
fruit: FRUITS.filter(x => x.available)[Math.floor(Math.random() * FRUITS.filter(x => x.available).length)],
|
fruit: FRUITS.filter(x => x.available)[Math.floor(Math.random() * FRUITS.filter(x => x.available).length)],
|
||||||
@ -423,8 +421,8 @@ class Game extends EventEmitter<{
|
|||||||
// TODO: fusion予約状態のアイテムは光らせるなどの演出をすると楽しそう
|
// TODO: fusion予約状態のアイテムは光らせるなどの演出をすると楽しそう
|
||||||
let fusionReservedPairs: { bodyA: Matter.Body; bodyB: Matter.Body }[] = [];
|
let fusionReservedPairs: { bodyA: Matter.Body; bodyB: Matter.Body }[] = [];
|
||||||
|
|
||||||
const minCollisionDepthForSound = 2.5;
|
const minCollisionEnergyForSound = 2.5;
|
||||||
const maxCollisionDepthForSound = 9;
|
const maxCollisionEnergyForSound = 9;
|
||||||
const soundPitchMax = 4;
|
const soundPitchMax = 4;
|
||||||
const soundPitchMin = 0.5;
|
const soundPitchMin = 0.5;
|
||||||
|
|
||||||
@ -451,8 +449,8 @@ class Game extends EventEmitter<{
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const energy = pairs.collision.depth;
|
const energy = pairs.collision.depth;
|
||||||
if (energy > minCollisionDepthForSound) {
|
if (energy > minCollisionEnergyForSound) {
|
||||||
const vol = (Math.min(maxCollisionDepthForSound, energy - minCollisionDepthForSound) / maxCollisionDepthForSound) / 4;
|
const vol = (Math.min(maxCollisionEnergyForSound, energy - minCollisionEnergyForSound) / maxCollisionEnergyForSound) / 4;
|
||||||
const pan = ((((bodyA.position.x + bodyB.position.x) / 2) / GAME_WIDTH) - 0.5) * 2;
|
const pan = ((((bodyA.position.x + bodyB.position.x) / 2) / GAME_WIDTH) - 0.5) * 2;
|
||||||
const pitch = soundPitchMin + ((soundPitchMax - soundPitchMin) * (1 - (Math.min(10, energy) / 10)));
|
const pitch = soundPitchMin + ((soundPitchMax - soundPitchMin) * (1 - (Math.min(10, energy) / 10)));
|
||||||
sound.playRaw('syuilo/poi1', vol, pan, pitch);
|
sound.playRaw('syuilo/poi1', vol, pan, pitch);
|
||||||
@ -700,7 +698,6 @@ definePageMetadata({
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
// なんかiOSでちらつく
|
// なんかiOSでちらつく
|
||||||
//filter: drop-shadow(0 6px 16px #0007);
|
//filter: drop-shadow(0 6px 16px #0007);
|
||||||
border-radius: 16px;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
@ -710,7 +707,8 @@ definePageMetadata({
|
|||||||
display: block;
|
display: block;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
margin-top: -50px;
|
margin-top: -50px;
|
||||||
max-width: 100%;
|
width: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user