Skip to content

Commit

Permalink
Merge pull request #615 from jeferris/panda-pet
Browse files Browse the repository at this point in the history
Add a panda
  • Loading branch information
tonybaloney authored Jan 20, 2025
2 parents 4231b74 + 5d0edaa commit 4c1789c
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ The horse animations were adapted by [Chris Kent](https://github.com/thechrisken

[Kennet Shin](https://github.com/WoofWoof0) created the snail media assets.

[Jessie Ferris](https://github.com/jeferris) created the panda media assets.

## Thank you

Thanks to all the [contributors](https://github.com/tonybaloney/vscode-pets/graphs/contributors) to this project.
Binary file added media/panda/black_idle_8fps.gif
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 media/panda/black_lie_8fps.gif
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 media/panda/black_run_8fps.gif
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 media/panda/black_swipe_8fps.gif
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 media/panda/black_walk_8fps.gif
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 media/panda/black_walk_fast_8fps.gif
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 media/panda/black_with_ball_8fps.gif
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 media/panda/brown_idle_8fps.gif
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 media/panda/brown_lie_8fps.gif
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 media/panda/brown_run_8fps.gif
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 media/panda/brown_swipe_8fps.gif
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 media/panda/brown_walk_8fps.gif
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 media/panda/brown_walk_fast_8fps.gif
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 media/panda/brown_with_ball_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/common/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DENO_NAMES } from '../panel/pets/deno';
import { DOG_NAMES } from '../panel/pets/dog';
import { FOX_NAMES } from '../panel/pets/fox';
import { MOD_NAMES } from '../panel/pets/mod';
import { PANDA_NAMES } from '../panel/pets/panda';
import { ROCKY_NAMES } from '../panel/pets/rocky';
import { DUCK_NAMES } from '../panel/pets/rubberduck';
import { SNAIL_NAMES } from '../panel/pets/snail';
Expand Down Expand Up @@ -40,6 +41,7 @@ export function randomName(type: PetType): string {
[PetType.rat]: RAT_NAMES,
[PetType.turtle]: TURTLE_NAMES,
[PetType.horse]: HORSE_NAMES,
[PetType.panda]: PANDA_NAMES,
} as Record<PetType, ReadonlyArray<string>>
)[type] ?? CAT_NAMES;

Expand Down
2 changes: 2 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const enum PetType {
fox = 'fox',
horse = 'horse',
mod = 'mod',
panda = 'panda',
rat = 'rat',
rocky = 'rocky',
rubberduck = 'rubber-duck',
Expand Down Expand Up @@ -98,6 +99,7 @@ export const ALL_PETS = [
PetType.fox,
PetType.horse,
PetType.mod,
PetType.panda,
PetType.rat,
PetType.rocky,
PetType.rubberduck,
Expand Down
5 changes: 5 additions & 0 deletions src/panel/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Dog } from './pets/dog';
import { Fox } from './pets/fox';
import { Horse } from './pets/horse';
import { Mod } from './pets/mod';
import { Panda } from './pets/panda';
import { Rat } from './pets/rat';
import { Rocky } from './pets/rocky';
import { RubberDuck } from './pets/rubberduck';
Expand Down Expand Up @@ -232,6 +233,8 @@ export function createPet(
return new Turtle(...standardPetArguments, PetSpeed.verySlow);
case PetType.horse:
return new Horse(...standardPetArguments, PetSpeed.normal);
case PetType.panda:
return new Panda(...standardPetArguments, PetSpeed.slow);
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down Expand Up @@ -275,6 +278,8 @@ export function availableColors(petType: PetType): PetColor[] {
return Turtle.possibleColors;
case PetType.horse:
return Horse.possibleColors;
case PetType.panda:
return Panda.possibleColors;
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down
92 changes: 92 additions & 0 deletions src/panel/pets/panda.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { PetColor, PetSize } from "../../common/types";

Check failure on line 1 in src/panel/pets/panda.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'PetSize' is defined but never used

Check failure on line 1 in src/panel/pets/panda.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'PetSize' is defined but never used
import { BasePetType } from "../basepettype";
import { States } from '../states';

export class Panda extends BasePetType {
label = 'panda';
static possibleColors = [
PetColor.black,
PetColor.brown,
];
sequence = {
startingState: States.sitIdle,
sequenceStates: [
{
state: States.sitIdle,
possibleNextStates: [
States.walkRight,
States.runRight,
States.lie,
],
},
{
state: States.lie,
possibleNextStates: [States.walkRight, States.walkLeft],
},
{
state: States.walkRight,
possibleNextStates: [
States.sitIdle,
States.lie,
States.walkLeft,
States.runLeft
],
},
{
state: States.runRight,
possibleNextStates: [
States.sitIdle,
States.lie,
States.walkLeft,
States.runLeft
],
},
{
state: States.walkLeft,
possibleNextStates: [
States.sitIdle,
States.lie,
States.walkRight,
States.runRight,
],
},
{
state: States.runLeft,
possibleNextStates: [
States.sitIdle,
States.lie,
States.walkRight,
States.runRight,
],
},
{
state: States.chase,
possibleNextStates: [States.idleWithBall],
},
{
state: States.idleWithBall,
possibleNextStates: [
States.sitIdle,
States.lie,
],
},
],
};
get emoji(): string {
return '🐼';
}
get hello(): string {
return `Zzzz bamboo`;
}
}

export const PANDA_NAMES: ReadonlyArray<string> = [
'Boba',
'Winnie',
'Teddy',
'Luna',
'Tofu',
'Mochi',
'Coco',
'Hana',
];
12 changes: 12 additions & 0 deletions src/test/gifs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ const pets: { [key: string]: { colors: string[]; states: string[] } } = {
colors: ['purple'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
},
panda: {
colors: ['black', 'brown'],
states: [
'idle',
'lie',
'run',
'swipe',
'walk',
'walk_fast',
'with_ball',
],
},
rocky: {
colors: ['gray'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast'],
Expand Down

0 comments on commit 4c1789c

Please sign in to comment.