Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinity Level Up #5

Merged
merged 6 commits into from
Feb 23, 2024
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
54 changes: 22 additions & 32 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,38 @@ import { useCounterStore } from './store/counter';
import BackDropComponent from './components/UI/BackDropComponent.vue';
import MetaComponent from './components/UI/MetaComponent.vue';
import TimerComponent from './components/UI/TimerComponent.vue';
import SelectedTileComponent from './components/UI/SelectedTileComponent.vue';
import { getSpritePathByColor, getCostByColor } from './utils';
// import { RoundedRectangle } from 'pixi.js';

const counterStore = useCounterStore();
let gm = {} as GameManager | null;

const onSellHandler = () => {
gm?.deleteSelectedObject();
counterStore.increment(currentCost.value);
};

const selecetedSprite = computed(() => {
return counterStore.color !== 'EMPTY'
? getSpritePathByColor[counterStore.color]
: getSpritePathByColor['EMPTY'];
});

const currentCost = computed(() => {
return getCostByColor[counterStore.color];
});

const timerPercentage = computed(() => {
return Math.round(counterStore.timerFill);
});

const selectedIsDisabled = computed(() => {
return counterStore.color === 'EMPTY';
});

onBeforeMount(() => {
counterStore.reset();
});

onMounted(() => {
gm = new GameManager(counterStore);
document.body.style.backgroundColor = '#000';
const loading = document.createElement('div');
loading.style.position = 'absolute';
loading.style.top = '0';
loading.style.left = '0';
loading.style.width = '100%';
loading.style.height = '100%';
loading.style.backgroundColor = '#000';
loading.style.display = 'flex';
loading.style.justifyContent = 'center';
loading.style.alignItems = 'center';
loading.style.zIndex = '1000';
loading.innerHTML = '<h1 style="color: #fff">Loading...</h1>';
document.body.appendChild(loading);

setTimeout(() => {
new GameManager(counterStore);
document.body.style.backgroundColor = '#fff';
document.body.removeChild(loading);
}, 1500);
});
</script>

Expand All @@ -52,12 +48,6 @@ onMounted(() => {
<meta-component class="info-item">Best: {{ counterStore.best }}</meta-component>
<meta-component class="info-item">Score: {{ counterStore.count }}</meta-component>
</back-drop-component>
<selected-tile-component
:disabled="selectedIsDisabled"
:selected-tile="selecetedSprite"
:cost="currentCost"
@sell-item="onSellHandler"
/>
</div>
<div id="root">
<canvas></canvas>
Expand All @@ -80,7 +70,7 @@ onMounted(() => {
border: 5px solid #fff

.info-wrapper
height: max-content
height: 100%
.info-item
align-self: center
width: 80%
Expand All @@ -92,7 +82,7 @@ onMounted(() => {
gap: 16px

@media (orientation: portrait)
grid-template-columns: 1fr 1fr
grid-template-columns: 1fr
grid-template-rows: 1fr
gap: 8px
</style>
Binary file added src/assets/sprites/blocks/blue.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 src/assets/sprites/blocks/red.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 src/assets/sprites/blocks/yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/UI/TimerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="panel">
<back-drop-component>
<div class="timer">
<MetaComponent class="timer__speed">Speed</MetaComponent>
<MetaComponent class="timer__speed">Timer</MetaComponent>
<div class="timer-wrapper">
<div class="timer-progress" :style="progressStyles" />
</div>
Expand Down
Loading