uses sprites in 2x resolution

This commit is contained in:
Lars Berning 2022-02-19 23:46:17 +01:00
parent 315015282a
commit 1133b91bfe
No known key found for this signature in database
GPG Key ID: 028E73C9E1D8A0B3
34 changed files with 13 additions and 23 deletions

View File

@ -1,17 +0,0 @@
'use strict'
/*
Open Rowing Monitor, https://github.com/laberning/openrowingmonitor
Kaboom based Game Engine for Rowing Games
*/
import kaboom from 'kaboom'
/**
*
* @param {import('kaboom').KaboomOpt} options Kaboom Options
* @returns KaboomCtx Kaboom Context
*/
export function createGameEngine (options) {
return kaboom(options)
}

View File

@ -5,7 +5,7 @@
Initializer for the Rowing Games
*/
import { createGameEngine } from './GameEngine.js'
import kaboom from 'kaboom'
import StrokeFighterBattleScene from './StrokeFighterBattleScene.js'
import StrokeFighterStartScene from './StrokeFighterStartScene.js'
@ -16,7 +16,7 @@ import StrokeFighterStartScene from './StrokeFighterStartScene.js'
* @param {number} clientHeight
*/
export function createRowingGames (rootComponent, canvasElement, clientWidth, clientHeight) {
const k = createGameEngine({
const k = kaboom({
debug: true,
global: false,
canvas: canvasElement,
@ -35,7 +35,7 @@ export function createRowingGames (rootComponent, canvasElement, clientWidth, cl
'laserRed01', 'laserRed09']
for (const sprite of sprites) {
k.loadSprite(sprite, `${assets}/sprites/${sprite}.png`)
k.loadSprite(sprite, `${assets}/sprites/${sprite}@2x.png`)
}
k.loadSound('hit', `${assets}/sounds/explosionCrunch_000.ogg`)
k.loadSound('shoot', `${assets}/sounds/laserSmall_001.ogg`)

View File

@ -38,7 +38,7 @@ export default function addSpaceBackground (k) {
k.add([
k.sprite(spriteName),
k.z(-100),
k.scale(k.rand(0.2, 0.7)),
k.scale(k.rand(0.1, 0.35)),
k.color(starColor, starColor, starColor),
k.pos(position),
'star',

View File

@ -57,6 +57,7 @@ export default function StrokeFighterBattleScene (k) {
const player = k.add([
k.sprite('playerShip2_orange'),
k.scale(0.5),
k.area(),
k.pos(k.width() / 2, k.height() - 64),
k.origin('center')
@ -105,7 +106,7 @@ export default function StrokeFighterBattleScene (k) {
k.add([
k.sprite('laserRed09'),
k.pos(pos.sub(0, 10)),
k.scale(k.vec2(0.5)),
k.scale(k.vec2(0.25)),
k.lifespan(0.1),
grow(k.rand(0.5, 2)),
k.origin('center')
@ -118,6 +119,7 @@ export default function StrokeFighterBattleScene (k) {
function spawnBullet (pos) {
k.add([
k.sprite('laserRed01'),
k.scale(0.5),
k.area(),
k.pos(pos),
k.origin('center'),
@ -154,12 +156,13 @@ export default function StrokeFighterBattleScene (k) {
function spawnEnemy (enemy) {
k.add([
k.sprite(enemy.sprite),
k.scale(0.5),
k.area(),
k.pos(k.rand(0 + SPRITE_WIDTH / 2, k.width() - SPRITE_WIDTH / 2), 0),
k.health(enemy.health),
k.origin('bot'),
'enemy',
{ speed: k.rand(ENEMY_SPEED * 0.5, ENEMY_SPEED * 1.5) }
{ speed: k.rand(ENEMY_SPEED * 0.8, ENEMY_SPEED * 1.2) }
])
}

View File

@ -28,6 +28,7 @@ export default function StrokeFighterStartScene (k) {
const shipsPos = k.vec2(450, 260)
const ship1 = k.add([
k.sprite('playerShip2_orange'),
k.scale(0.5),
k.pos(shipsPos),
k.origin('center')
])
@ -35,6 +36,7 @@ export default function StrokeFighterStartScene (k) {
const ship2 = k.add([
k.sprite('playerShip2_orange'),
k.scale(0.5),
k.pos(shipsPos.add(0, 140)),
k.origin('center')
])
@ -43,6 +45,7 @@ export default function StrokeFighterStartScene (k) {
const ship3 = k.add([
k.sprite('playerShip2_orange'),
k.scale(0.5),
k.pos(shipsPos.add(0, 280)),
k.origin('center')
])
@ -70,6 +73,7 @@ export default function StrokeFighterStartScene (k) {
function addBullet (pos) {
k.add([
k.sprite('laserRed01'),
k.scale(0.5),
k.pos(pos),
k.origin('center')
])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB