Skip to content

Commit cd906f4

Browse files
add giffes
1 parent 65a37d3 commit cd906f4

File tree

15 files changed

+59
-69
lines changed

15 files changed

+59
-69
lines changed

README.md

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,29 @@
11
# Svelte + TypeScript + Vite
2-
3-
**Сайт**: [hikers-bay.vercel.app](https://hikers-bay.vercel.app/)
4-
**Видео**: [Смотреть видео](https://drive.google.com/file/d/1dtvia9FmMCbD1kVNiKGhhoNly3w4hElt/view?usp=sharing)
5-
**Карта**: [Скачать карту](https://disk.yandex.ru/d/o6s72EUwudpdyA)
6-
7-
### Управление в конструкторе:
2+
#### website: https://hikers-bay.vercel.app/
3+
###### video: https://disk.yandex.ru/i/AideJuDcLOB5Jg
4+
###### map: https://disk.yandex.ru/d/o6s72EUwudpdyA
85
```
9-
Наведи курсор на клетку:
10-
Shift + ЛКМ: создать клетку
11-
Ctrl + ЛКМ: удалить клетку
12-
Alt + ЛКМ: удалить все клетки до нужной
13-
Двойной клик ЛКМ: открыть инвентарь клетки
6+
В конструкторе навведись на клетку:
7+
shiftLeft+mouseLeftButton: создать клетку
8+
CtrlLeft+mouseLeftButton: удалить клетку
9+
AltLeft+mouseLeftButton: удалить все клетки до нужно
10+
MouseLeft_DoubleClick: при клике на клетку откроется инвентарь
1411
```
1512

16-
### Возможности:
17-
18-
1. **Создание собственных карт**
19-
Пользователи могут создавать собственные карты с помощью конструктора, добавляя ловушки, оружие и другие элементы.
20-
21-
2. **Сохранение карт**
22-
Есть возможность сохранять созданные карты локально на ПК или на сайте.
23-
24-
3. **Загрузка карт в комнату**
25-
Пользователи могут подгружать карты в игровую комнату.
26-
27-
4. **Настройка количества пользователей**
28-
При создании комнаты можно указать количество пользователей.
29-
30-
5. **Очередность ходов**
31-
При подгрузке комнаты у пользователей появляется возможность ходить по карте по очереди несколько раз (рандомно).
13+
<ol>
14+
<li>Можешь создавать собственную карту с помощью конструктора , к клеткам добавлять ловушки оружия и т.д</li>
15+
<li>Есть возможность сохранять эту карту локально на пк или на сайт </li>
16+
<li>Можно подгружать карту в комнату </li>
17+
<li>При создании комнаты можешь добавлять количество юзеров </li>
18+
<li>При подгруздки комнаты - у пользователя появляется возможность ходить по карте по-очерёдно n раз (рандомно) </li>
19+
<li>Пользователь может натыкаться на ловушки или бафы, а также собирать оружия </li>
20+
<li>Пользователь может дамажить противников и получать за это деньги</li>
21+
</ol>
3222

33-
6. **Взаимодействие с ловушками и бафами**
34-
Пользователи могут натыкаться на ловушки или получать бафы, а также собирать оружие.
23+
<img src="https://github.com/user-attachments/assets/a07730f4-82fd-432e-af70-e585bf40fa2f" width="1200"/>
3524

36-
7. **Бой с противниками**
37-
Пользователи могут атаковать противников и зарабатывать деньги за успешные действия.
25+
### Конструктор
26+
<img src="/assets/gif/Hikers_constructor.gif" width="1200"/>
3827

39-
![Превью карты](https://github.com/user-attachments/assets/a07730f4-82fd-432e-af70-e585bf40fa2f)
28+
### Комната
29+
<img src="/assets/gif/Hikers_room.gif" width="1200"/>

assets/gif/Hikers_constructor.gif

166 KB
Loading

assets/gif/Hikers_room.gif

534 KB
Loading

src/lib/components/constructor/Cell/BTNDirection.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import storeCells from "store/stCells";
33
import Einity from "utils/game/Enity";
44
import { stepBtn } from "utils/game/game.config";
5-
import type { CEnity, TDirect, TMode } from "lib/types";
5+
import type { CEntity, TDirect, TMode } from "lib/types";
66
77
let fill:string = 'green';
8-
export let cell:CEnity;
8+
export let cell:CEntity;
99
export let direct:TDirect|'CENTER';
1010
export let mode: TMode;
1111

src/lib/components/constructor/Cell/Cell.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts">
22
import stCell from "store/stCell";
33
import BtnDirection from "./BTNDirection.svelte";
4-
import type { CEnity, TMode } from "lib/types";
4+
import type { CEntity, TMode } from "lib/types";
55
6-
export let cell:CEnity;
6+
export let cell:CEntity;
77
export let cbToOpenStoreRoles:Function;
88
99
let mode:TMode|'NONE' = 'ADD';

src/lib/components/constructor/Constructor.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { onDestroy, onMount } from "svelte";
3-
import {type CEnity} from "lib/types";
3+
import {type CEntity} from "lib/types";
44
import Cell from "./Cell/Cell.svelte";
55
import stCells from "store/stCells";
66
import Scene from "lib/components/Scene.svelte";
@@ -12,7 +12,7 @@
1212
import Notification from "lib/ul/Notification.svelte";
1313
1414
15-
let cells:CEnity[];
15+
let cells:CEntity[];
1616
let scene:Scene;
1717
let notification:Notification;
1818
let cheatSheet:Notification;

src/lib/components/constructor/windows/StoreOfMap.svelte

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import type { CEnity } from "lib/types";
2+
import type { CEntity } from "lib/types";
33
import DraggableWin from "lib/ul/DraggableWin.svelte";
44
import stCells from "store/stCells";
55
import { onMount } from "svelte";
@@ -14,7 +14,7 @@
1414
export let isConstructor:boolean = true;
1515
export let toCreateNewMap:Function|undefined = undefined;
1616
export let cbResetCounter: Function|undefined = undefined;
17-
export let cbToLaodMap: ((map:CEnity[]) => boolean) | undefined = undefined;
17+
export let cbToLoadMap: ((map:CEntity[]) => boolean) | undefined = undefined;
1818
1919
$: console.log(files)
2020
$: if (files !== null && files.length > 0) {
@@ -25,9 +25,9 @@
2525
win.toOpenWin();
2626
}
2727
28-
function toLaodMap(key:string, value:string, isComputer: boolean = false) {
28+
function toLoadMap(key:string, value:string, isComputer: boolean = false) {
2929
const toLoad = () => {
30-
const map = stCells.getDencryptMap(value);
30+
const map = stCells.getDecryptMap(value);
3131
stCells.setNameMap({name:key, isComputer});
3232
stCells.toLoadMap(
3333
map,
@@ -41,10 +41,10 @@
4141
}
4242
4343
44-
if(cbToLaodMap === undefined) toLoad();
44+
if(cbToLoadMap === undefined) toLoad();
4545
else {
46-
const map = stCells.getDencryptMap(value);
47-
const trigger = cbToLaodMap(map);
46+
const map = stCells.getDecryptMap(value);
47+
const trigger = cbToLoadMap(map);
4848
4949
if(trigger) toLoad()
5050
else {
@@ -61,7 +61,7 @@
6161
reader.onload = (e) => {
6262
if(e.target?.result) {
6363
files = null;
64-
toLaodMap(name, e.target.result as string, true);
64+
toLoadMap(name, e.target.result as string, true);
6565
}
6666
}
6767
@@ -114,7 +114,7 @@
114114
<div class="StoreOfMap_saved_map">
115115
<span>{toFormattedMap(key)}</span>
116116
<div class="container">
117-
<button on:click={() => toLaodMap(key, value)} class="StoreOfMap_saved_map_btn">открыть</button>
117+
<button on:click={() => toLoadMap(key, value)} class="StoreOfMap_saved_map_btn">открыть</button>
118118
<button on:click={() => toRemoveMap(key, index)} class="StoreOfMap_saved_map_btn">удалить</button>
119119
</div>
120120
</div>
@@ -146,7 +146,7 @@
146146
<div class="StoreOfMap_saved_map">
147147
<span>{toFormattedMap(key)}</span>
148148
<div class="container">
149-
<button on:click={() => toLaodMap(key, value)} class="StoreOfMap_saved_map_btn">открыть</button>
149+
<button on:click={() => toLoadMap(key, value)} class="StoreOfMap_saved_map_btn">открыть</button>
150150
</div>
151151
</div>
152152
{/if}

src/lib/components/room/Cell.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
2-
import type { CEnity } from "lib/types";
2+
import type { CEntity } from "lib/types";
33
4-
export let cell:CEnity;
4+
export let cell:CEntity;
55
export let show:'INDEX'|'DIRECTION' = 'INDEX';
66
const isVPrev = cell.prevCell?.featureDirection === 'TOP' || cell.prevCell?.featureDirection === 'BOTTOM';
77
const isVCurr = cell?.featureDirection === 'TOP' || cell?.featureDirection === 'BOTTOM';

src/lib/components/room/offline/Room.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<div class="container">
126126
<div class="container __storeOfMap">
127127
<h2>Выбери Карты</h2>
128-
<StoreOfMap isConstructor={false} cbToLaodMap={start}/>
128+
<StoreOfMap isConstructor={false} cbToLoadMap={start}/>
129129
</div>
130130
<div class="container __characters">
131131
<StoreOfCharacters/>

src/lib/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import type User from "utils/game/User";
22
import Einity from "../utils/game/Enity";
33

44
export type CUser = User;
5-
export type CEnity = Einity;
5+
export type CEntity = Einity;
66
export type TMode = 'ADD'|'REMOVE';
77
export type TPage = 'START'|'CONSTRUCTOR'|'ROOM_OFFLINE'|'ROOM_ONLINE';
88
export type TDirects = ['RIGHT'?,'LEFT'?,'TOP'?,'BOTTOM'?];
99
export type TDirect = 'RIGHT'|'LEFT'|'BOTTOM'|'TOP';
1010

11-
export type TUserAction = (user:CUser, cell:CEnity, currStep:number, timeID: NodeJS.Timeout, map:CEnity[]) => void;
11+
export type TUserAction = (user:CUser, cell:CEntity, currStep:number, timeID: NodeJS.Timeout, map:CEntity[]) => void;
1212
export type TCBAction = (apponent?: CUser, cbDamageEffect?:Function) => void|boolean;
1313
export type TUserDataAction = {cb?:TCBAction, status:boolean, qntyBuffs: number, qntyInventory:number, isShow:boolean, apponents:Function[]};
1414

src/store/stCell.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {writable} from 'svelte/store';
22
import type Einity from 'utils/game/Enity';
3-
import type { CEnity } from 'lib/types';
3+
import type { CEntity } from 'lib/types';
44

55
export function stCell() {
6-
const {subscribe, set} = writable<CEnity>();
6+
const {subscribe, set} = writable<CEntity>();
77

88
return {
99
subscribe,

src/store/stCells.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {writable} from 'svelte/store';
2-
import type { CEnity } from 'lib/types';
2+
import type { CEntity } from 'lib/types';
33
import crypto from 'crypto-js'
44
import Einity from 'utils/game/Enity';
55

66

77
const key = 'dcr';
88
export type TNameMap = {name:string,isComputer:boolean}|undefined;
99
export function stCells() {
10-
const {subscribe, update, set} = writable<CEnity[]>([]);
10+
const {subscribe, update, set} = writable<CEntity[]>([]);
1111
const nameMap = writable<TNameMap>();
1212

1313
return {
@@ -36,12 +36,12 @@ export function stCells() {
3636
this.setNameMap(undefined);
3737
},
3838

39-
addChild: (cell:CEnity) => update((store) => {
39+
addChild: (cell:CEntity) => update((store) => {
4040
store.push(cell);
4141
return store;
4242
}),
4343

44-
removeChild: (cell:CEnity) => update((store) => {
44+
removeChild: (cell:CEntity) => update((store) => {
4545
return store.filter((item) => item !== cell);
4646
}),
4747

@@ -62,7 +62,7 @@ export function stCells() {
6262
return map!;
6363
},
6464

65-
getDencryptMap: (str:string) => {
65+
getDecryptMap: (str:string) => {
6666
const decrypt = crypto.AES.decrypt(str, key).toString(crypto.enc.Utf8);
6767
return JSON.parse(decrypt) as Einity[]
6868
},
@@ -87,7 +87,7 @@ export function stCells() {
8787

8888
reload: () => update((store) => [...store]),
8989

90-
removeAllAfterCell: (cell:CEnity) => {
90+
removeAllAfterCell: (cell:CEntity) => {
9191
update((store) => {
9292
for(let i = store.length; true; i--) {
9393
if(cell === store[i]) {

src/store/user/stUsers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {writable} from 'svelte/store';
2-
import type { CEnity, CUser, TUserAction } from 'lib/types';
2+
import type { CEntity, CUser, TUserAction } from 'lib/types';
33

44
export function stUsers() {
55
const {subscribe, update, set} = writable<CUser[]>([]);
@@ -16,7 +16,7 @@ export function stUsers() {
1616
});
1717
return users!;
1818
},
19-
reloadPosition: (map:CEnity[]) => {
19+
reloadPosition: (map:CEntity[]) => {
2020
update((users) => {
2121
users.forEach((user) => {
2222
const cell = map[user.indCell];
@@ -69,7 +69,7 @@ export function stUsers() {
6969
},
7070

7171
toDoStep: function (
72-
map:CEnity[], user:CUser, qntySteps: number, userActions:TUserAction,
72+
map:CEntity[], user:CUser, qntySteps: number, userActions:TUserAction,
7373
cbListenerMove: (user:CUser) => void,
7474
cbResetActiveUser: Function ,
7575
speed:number = 500

src/utils/game/Enity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import toReverseDirection from "utils/toReverseDirection";
2-
import type {CEnity, TDirect, TDirects } from "lib/types";
2+
import type {CEntity, TDirect, TDirects } from "lib/types";
33
import { ERoles, rounded, stepCell, sizeCell } from "utils/game/game.config";
44

55
export default class Einity {
@@ -14,7 +14,7 @@ export default class Einity {
1414
public readonly step:number = stepCell;
1515
public readonly rounded: number = rounded;
1616

17-
constructor(data?:CEnity) {
17+
constructor(data?:CEntity) {
1818
Object.assign(this, data)
1919
}
2020

src/utils/game/userActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CEnity, CUser, TCBAction, TUserDataAction } from "lib/types";
1+
import type { CEntity, CUser, TCBAction, TUserDataAction } from "lib/types";
22
import { DataOfRoles, ERoles } from "./game.config";
33
import stUsers from "store/user/stUsers";
44
import playAudio from "utils/PlayerAudio";
@@ -45,7 +45,7 @@ const cb = (user:CUser, action: ERoles, typeQnty:'qntyBuffs'|'qntyInventory') =>
4545
}
4646

4747

48-
export type TProps = {user:CUser, cell?:CEnity, step?:number, map?:CEnity[]};
48+
export type TProps = {user:CUser, cell?:CEntity, step?:number, map?:CEntity[]};
4949

5050
export const cbUserActions:Record<ERoles, (props:TProps) => void|TCBAction > = {
5151

@@ -237,7 +237,7 @@ export const cbUserActions:Record<ERoles, (props:TProps) => void|TCBAction > = {
237237
}
238238

239239
const tabooRoles = [ERoles.MONEY, ERoles.POISON, ERoles.POTION, ERoles.PORTAL, ERoles.HANDCUFFS, ERoles.BOMB, ERoles.NEXT ];
240-
export default (user: CUser, cell:CEnity, currStep:number, timeID: NodeJS.Timeout, map:CEnity[]) => {
240+
export default (user: CUser, cell:CEntity, currStep:number, timeID: NodeJS.Timeout, map:CEntity[]) => {
241241
if(cell.role && cell.role in cbUserActions && currStep === 0) {
242242

243243
const s = user.actions.HANDCUFFS?.cb!();

0 commit comments

Comments
 (0)