Skip to content

Commit

Permalink
Merge pull request #577 from WoofWoof0/add-snail-pet
Browse files Browse the repository at this point in the history
Add snail pet
  • Loading branch information
tonybaloney authored Jun 17, 2024
2 parents 7b51983 + 441977d commit a48fb66
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ The turtle animations were designed by enkeefe using [Pixelart](https://www.pixi

The horse animations were adapted by [Chris Kent](https://github.com/thechriskent) from assets by [Onfe](https://onfe.itch.io/horse-sprite-with-rider-asset-pack).

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

## Thank you

Thanks to all the [contributors](https://github.com/tonybaloney/vscode-pets/graphs/contributors) to this project.
Binary file added media/snail/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/snail/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/snail/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/snail/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/snail/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/snail/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 @@ -9,6 +9,7 @@ import { FOX_NAMES } from '../panel/pets/fox';
import { MOD_NAMES } from '../panel/pets/mod';
import { ROCKY_NAMES } from '../panel/pets/rocky';
import { DUCK_NAMES } from '../panel/pets/rubberduck';
import { SNAIL_NAMES } from '../panel/pets/snail';
import { SNAKE_NAMES } from '../panel/pets/snake';
import { TOTORO_NAMES } from '../panel/pets/totoro';
import { ZAPPY_NAMES } from '../panel/pets/zappy';
Expand All @@ -30,6 +31,7 @@ export function randomName(type: PetType): string {
[PetType.deno]: DENO_NAMES,
[PetType.mod]: MOD_NAMES,
[PetType.totoro]: TOTORO_NAMES,
[PetType.snail]: SNAIL_NAMES,
[PetType.snake]: SNAKE_NAMES,
[PetType.rubberduck]: DUCK_NAMES,
[PetType.zappy]: ZAPPY_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 @@ -35,6 +35,7 @@ export const enum PetType {
rat = 'rat',
rocky = 'rocky',
rubberduck = 'rubber-duck',
snail = 'snail',
snake = 'snake',
totoro = 'totoro',
turtle = 'turtle',
Expand Down Expand Up @@ -100,6 +101,7 @@ export const ALL_PETS = [
PetType.rat,
PetType.rocky,
PetType.rubberduck,
PetType.snail,
PetType.snake,
PetType.totoro,
PetType.turtle,
Expand Down
6 changes: 6 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ export function activate(context: vscode.ExtensionContext) {
},
);
if (selectedColor === undefined) {
console.log(
'Cancelled Spawning Pet - No Pet Color Selected',
);
return;
}
petColor = selectedColor.value;
Expand All @@ -540,6 +543,9 @@ export function activate(context: vscode.ExtensionContext) {
}

if (petColor === undefined) {
console.log(
'Cancelled Spawning Pet - No Pet Color Selected',
);
return;
}

Expand Down
5 changes: 5 additions & 0 deletions src/panel/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Mod } from './pets/mod';
import { Rat } from './pets/rat';
import { Rocky } from './pets/rocky';
import { RubberDuck } from './pets/rubberduck';
import { Snail } from './pets/snail';
import { Snake } from './pets/snake';
import { Totoro } from './pets/totoro';
import { Turtle } from './pets/turtle';
Expand Down Expand Up @@ -194,6 +195,8 @@ export function createPet(
return new Mod(...standardPetArguments, PetSpeed.normal);
case PetType.totoro:
return new Totoro(...standardPetArguments, PetSpeed.normal);
case PetType.snail:
return new Snail(...standardPetArguments, PetSpeed.verySlow);
case PetType.snake:
return new Snake(...standardPetArguments, PetSpeed.verySlow);
case PetType.rubberduck:
Expand Down Expand Up @@ -235,6 +238,8 @@ export function availableColors(petType: PetType): PetColor[] {
return Mod.possibleColors;
case PetType.totoro:
return Totoro.possibleColors;
case PetType.snail:
return Snail.possibleColors;
case PetType.snake:
return Snake.possibleColors;
case PetType.rubberduck:
Expand Down
70 changes: 70 additions & 0 deletions src/panel/pets/snail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { PetColor } from '../../common/types';
import { BasePetType } from '../basepettype';
import { States } from '../states';

export class Snail extends BasePetType {
label = 'snail';
static possibleColors = [PetColor.brown];

sequence = {
startingState: States.sitIdle,
sequenceStates: [
{
state: States.sitIdle,
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.walkRight,
States.runRight,
],
},
{
state: States.runLeft,
possibleNextStates: [
States.sitIdle,
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 'hello! 👋';
}
}

export const SNAIL_NAMES: ReadonlyArray<string> = [
'Flash',
'Sonwy',
'Shally',
'Taggy',
];
4 changes: 4 additions & 0 deletions src/test/gifs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const pets: { [key: string]: { colors: string[]; states: string[] } } = {
colors: ['yellow'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
},
snail: {
colors: ['brown'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
},
snake: {
colors: ['green'],
states: ['idle', 'run', 'swipe', 'walk', 'walk_fast', 'with_ball'],
Expand Down

0 comments on commit a48fb66

Please sign in to comment.