Skip to content

Commit

Permalink
add in flying bird asset to city map plus sprite sheet and credits
Browse files Browse the repository at this point in the history
  • Loading branch information
Duella12345 committed Oct 31, 2024
1 parent 2638604 commit 75a92e2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion asset_credits.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ https://openart.ai/ - sprites for Sinusoid Formula Game on Machine #11 (formula

https://pop-shop-packs.itch.io/cats-pixel-asset-pack

https://kenney.nl/assets/puzzle-pack - sprites for Break Brick Game on Machine #5
https://kenney.nl/assets/puzzle-pack - sprites for Break Brick Game on Machine #5

https://free-game-assets.itch.io/free-street-animal-pixel-art-asset-pack - crow sprite for city map
Binary file added public/assets/sprites/bird_flying.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/gameObjects/map_city/flyingBirds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export const flyingBirds = (k, map) => {
// Load the bird sprite from the sprite sheet
k.loadSprite('bird', './assets/sprites/bird_flying.png', {
sliceX: 6,
sliceY: 1,
anims: {
fly: { from: 0, to: 5, loop: true },
},
});

function spawnBird() {
const bird = k.add([
k.sprite('bird'),
k.pos(k.vec2(0, 780)),
k.area(),
]);

bird.play('fly');

//Update bird movement and animation based on its state
bird.onUpdate(() => {
bird.move(140, 0);

if (bird.pos.x > 1900) {
k.destroy(bird);
}
});

return bird;
}

const birds = [];

k.loop(8, () => {
const bird = spawnBird();
birds.push(bird);
});

return birds;

};
2 changes: 2 additions & 0 deletions src/gameObjects/map_city/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { movingCars } from './movingCars';
import { flyingBirds } from './flyingBirds';
import { npcsInCityMap } from './npcsOnmap_city';
const gameObjects = [
npcsInCityMap,
// Add more game objects here
movingCars,
flyingBirds,
];

export default gameObjects;

0 comments on commit 75a92e2

Please sign in to comment.