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

Adding a Turtle Pet #401

Merged
merged 9 commits into from
Mar 27, 2023
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ The forest theme was designed by [edermunizz](https://edermunizz.itch.io/free-pi

[Karen Rustad Tölva](https://www.aldeka.net) designed the original concept of Ferris the crab.

The turtle animations were designed by enkeefe using [Pixelart](https://www.pixilart.com/draw).

## Thank you

Thanks to all the [contributors](https://github.com/tonybaloney/vscode-pets/graphs/contributors) to this project.
4 changes: 2 additions & 2 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Open the setting panel with `Ctrl+,` on Windows/Linux or `Cmd(⌘)+,` on MacOS.

Set a default color, size, pet type, position, and theme when you open a Pet Panel.

* Pet Color: black, brown, green, yellow, gray, purple, red, white
* Pet Color: black, brown, green, yellow, gray, purple, red, white, orange
* Pet Size: nano, small, medium, large
* Pet Type: cat, chicken, crab, clippy, cockatiel, dog, mod, rocky, rubber duck, snake, totoro, zappy
* Pet Type: cat, chicken, crab, clippy, cockatiel, dog, mod, rocky, rubber duck, snake, totoro, turtle, zappy

.. image:: _static/screenshot-2.gif
:alt: Usage screenshot
Expand Down
Binary file added media/turtle/green_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/turtle/green_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/turtle/green_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/turtle/green_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/turtle/green_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/turtle/orange_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/turtle/orange_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/turtle/orange_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/turtle/orange_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/turtle/orange_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.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@
"gray",
"purple",
"red",
"white"
"white",
"orange"
],
"default": "brown",
"description": "Pet color",
Expand All @@ -175,12 +176,13 @@
"dog",
"fox",
"mod",
"rat",
"rocky",
"rubber-duck",
"snake",
"totoro",
"zappy",
"rat"
"turtle",
"zappy"
],
"default": "cat",
"description": "Pet type",
Expand Down
2 changes: 2 additions & 0 deletions src/common/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SNAKE_NAMES } from '../panel/pets/snake';
import { TOTORO_NAMES } from '../panel/pets/totoro';
import { ZAPPY_NAMES } from '../panel/pets/zappy';
import { RAT_NAMES } from '../panel/pets/rat';
import { TURTLE_NAMES } from '../panel/pets/turtle';
import { PetType } from './types';

export function randomName(type: PetType): string {
Expand All @@ -32,6 +33,7 @@ export function randomName(type: PetType): string {
[PetType.rocky]: ROCKY_NAMES,
[PetType.cockatiel]: COCKATIEL_NAMES,
[PetType.rat]: RAT_NAMES,
[PetType.turtle]: TURTLE_NAMES,
} as Record<PetType, ReadonlyArray<string>>
)[type] ?? CAT_NAMES;

Expand Down
4 changes: 4 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const enum PetColor {
purple = 'purple',
red = 'red',
white = 'white',
orange = 'orange',
null = 'null',
}

Expand All @@ -25,6 +26,7 @@ export const enum PetType {
rubberduck = 'rubber-duck',
snake = 'snake',
totoro = 'totoro',
turtle = 'turtle',
zappy = 'zappy',
null = 'null',
}
Expand Down Expand Up @@ -87,6 +89,7 @@ export const ALL_PETS = [
PetType.rubberduck,
PetType.snake,
PetType.totoro,
PetType.turtle,
PetType.zappy,
];
export const ALL_COLORS = [
Expand All @@ -99,6 +102,7 @@ export const ALL_COLORS = [
PetColor.purple,
PetColor.red,
PetColor.white,
PetColor.orange,
PetColor.null,
];
export const ALL_SCALES = [
Expand Down
5 changes: 5 additions & 0 deletions src/panel/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Snake } from './pets/snake';
import { Totoro } from './pets/totoro';
import { Zappy } from './pets/zappy';
import { Rat } from './pets/rat';
import { Turtle } from './pets/turtle';
import { IPetType } from './states';

export class PetElement {
Expand Down Expand Up @@ -201,6 +202,8 @@ export function createPet(
return new Cockatiel(...standardPetArguments, PetSpeed.normal);
case PetType.rat:
return new Rat(...standardPetArguments, PetSpeed.normal);
case PetType.turtle:
return new Turtle(...standardPetArguments, PetSpeed.slow);
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down Expand Up @@ -236,6 +239,8 @@ export function availableColors(petType: PetType): PetColor[] {
return Cockatiel.possibleColors;
case PetType.rat:
return Rat.possibleColors;
case PetType.turtle:
return Turtle.possibleColors;
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down
113 changes: 113 additions & 0 deletions src/panel/pets/turtle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { PetColor } from '../../common/types';
import { BasePetType } from '../basepettype';
import { States } from '../states';

export class Turtle extends BasePetType {
label = 'turtle';
static possibleColors = [PetColor.green, PetColor.orange];
sequence = {
startingState: States.sitIdle,
sequenceStates: [
{
state: States.sitIdle,
possibleNextStates: [
States.walkRight,
States.runRight,
States.lie,
],
},
{
state: States.lie,
possibleNextStates: [States.walkRight, States.runRight],
},
{
state: States.walkRight,
possibleNextStates: [States.walkLeft, States.runLeft],
},
{
state: States.runRight,
possibleNextStates: [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.walkRight,
States.walkLeft,
States.runLeft,
States.runRight,
],
},
],
};
get emoji(): string {
return '🐢';
}
get hello(): string {
return ` Slow and steady wins the race!`;
}
}

export const TURTLE_NAMES: ReadonlyArray<string> = [
'Shelldon',
'Shelly',
'Shelley',
'Sheldon',
'Tortuga',
'Tortellini',
'Charlie',
'Ross',
'Squirt',
'Crush',
'Squirtle',
'Koopa',
'Bowser',
'Bowsette',
'Franklin',
'Koopa Troopa',
'Blastoise',
'Cecil',
'Wartortle',
'Donatello',
'Michaelangelo',
'Leonardo',
'Leo',
'Donny',
'Mikey',
'Raphael',
'Chelone',
'Emily',
'Joseph',
'Anne',
'Zagreus',
'Kratos',
'Atreus',
'Loki',
'Freya',
'Brevity',
'Arthur',
'Doyle',
'Sherlock',
'Charli',
];
5 changes: 5 additions & 0 deletions src/test/gifs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const pets: { [key: string]: { colors: string[]; states: string[] } } = {
colors: ['gray'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast'],
},
// eslint-disable-next-line @typescript-eslint/naming-convention
'rubber-duck': {
colors: ['yellow'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
Expand Down Expand Up @@ -88,6 +89,10 @@ const pets: { [key: string]: { colors: string[]; states: string[] } } = {
colors: ['gray', 'white', 'brown'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
},
turtle: {
colors: ['green', 'orange'],
states: ['idle', 'run', 'walk', 'lie', 'with_ball'],
},
};

function checkGifFilenames(folder: string) {
Expand Down