Skip to content

Commit

Permalink
Run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 22, 2024
1 parent 0b67565 commit 34a42f3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/core/kaplay/interactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export const attachInteractions = (interactions, gameObjTag) => {
k.onSceneLeave((currentScene) => {
saveScene(currentScene);
});

};
1 change: 0 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ if (gameState) {
k.go('start'); // Go to the default starting scene
}


// To test different maps instead of going through each and every scene to get to yours,
// Import the scene, name the scene, and then name the spawn point as an additional tag
// k.go('insert_scene_name_here', 'insert_spawn_point_here');
Expand Down
4 changes: 2 additions & 2 deletions src/player.controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export const addPlayerControls = (player) => {
? player.state.speed * 1.25
: player.state.speed * 1.1
: player.state.energy >= 50
? player.state.speed * 0.707106781188095 * 1.25 // Dot product for diagonal movement 45%
: player.state.speed * 0.707106781188095 * 1.1;
? player.state.speed * 0.707106781188095 * 1.25 // Dot product for diagonal movement 45%
: player.state.speed * 0.707106781188095 * 1.1;

player.move(moveDir.unit().scale(speed));
});
Expand Down
10 changes: 4 additions & 6 deletions src/scenes/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ export async function bootstrap(bootMapCb, mapArgs) {
const [map, spawnpoint, gameObjects, interactions, sounds] =
await bootMapCb();


if (mapArgs?.enter_tag === "Player") {
player.pos.x = gameState.player.position.x
player.pos.y = gameState.player.position.y
}
else {
if (mapArgs?.enter_tag === 'Player') {
player.pos.x = gameState.player.position.x;
player.pos.y = gameState.player.position.y;
} else {
player.pos =
(mapArgs?.enter_tag && spawnpoint[mapArgs?.enter_tag]) ||
spawnpoint.player;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/gameState.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const initialState = () => ({
isInDialog: false,
collectedCoins: 0,
score: 0,
scene: "start",
position: { x: 32, y: 384 }
scene: 'start',
position: { x: 32, y: 384 },
},
});

Expand All @@ -23,7 +23,7 @@ let currentState = undefined;

export const clearSavedGame = () => {
localStorage.removeItem(LOCAL_STORAGE_GAME_STATE_KEY);
currentState = undefined
currentState = undefined;
};

const syncStateProps = (stateToCheck, defaultState) => {
Expand Down
16 changes: 7 additions & 9 deletions src/utils/saveCurrentScene.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getGameState, setGameState } from "./gameState";
import { getGameState, setGameState } from './gameState';

// Function to save current scene to local storage
export const saveScene = (sceneName) => {
Expand All @@ -9,10 +9,9 @@ export const saveScene = (sceneName) => {
// console.log(`Scene ${sceneName} saved to local storage.`);

const gameState = getGameState();
gameState.player["scene"] = sceneName;
gameState.player['scene'] = sceneName;
setGameState(gameState);

}
};

// Function to save player's position to local storage
export const savePosition = (player) => {
Expand All @@ -26,10 +25,9 @@ export const savePosition = (player) => {
// console.log(`Position (${player.pos.x}, ${player.pos.y}) saved to local storage.`);

const gameState = getGameState();
gameState.player["position"] = {
gameState.player['position'] = {
x: player.pos.x,
y: player.pos.y
}
y: player.pos.y,
};
setGameState(gameState);
}

};

0 comments on commit 34a42f3

Please sign in to comment.