-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# KAPLAY Starter | ||
|
||
👋 Welcome to KAPLAY! | ||
|
||
This README includes everything you need to start writing game quickly. | ||
|
||
## Project Structure | ||
|
||
```bash | ||
. | ||
├── src | ||
│ ├── ... | ||
│ ├── scenes | ||
│ │ └── starter.ts # An Example Of A Simple Scene In KAPLAY | ||
│ └── components # This Is Where Your Components Would Live To Be Accessed By Nodes | ||
├── public | ||
│ └── put images here | ||
├── ... | ||
├── theme.ts # Customize the theme of the tutorial | ||
└── tsconfig.json # Typescript Config | ||
``` | ||
|
||
## Getting Started | ||
|
||
Make sure you have all dependencies installed and started the dev server: | ||
|
||
```bash | ||
pnpm install | ||
pnpm run dev | ||
``` | ||
|
||
## UI Structure | ||
|
||
```markdown | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ● ● ● │ | ||
├─────────────────────────────────────┬──────────────────────────────────────────────────────────┤ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ Your Code │ │ | ||
│ │ │ | ||
│ │ Game Preview │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
│ │ │ | ||
├─────────────────────────────────────┤ │ | ||
│ │ │ | ||
│ Terminal │ │ | ||
│ │ │ | ||
└─────────────────────────────────────┴──────────────────────────────────────────────────────────┘ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>KAPLAY Game</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./src/main.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "kaplay-starter", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.5.3", | ||
"vite": "^5.4.2", | ||
"kaplay": "3001.0.0-beta.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function cmp_spin(){ | ||
let me: any | ||
return { | ||
add() { | ||
me = this as any | ||
}, | ||
update() { | ||
me.angle -= 2.222222222 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import kaplay from 'kaplay'; | ||
|
||
export const k = kaplay({ | ||
background: [0,0,0], | ||
width: 1280, | ||
height: 720, | ||
letterbox: true, | ||
}); | ||
|
||
export default k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import k from "./kaplay"; | ||
import scn_starter from "./scenes/starter"; | ||
|
||
k.scene("starter", scn_starter); | ||
|
||
k.go("starter"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import cmp_spin from "../components/spin"; | ||
import k from "../kaplay"; | ||
|
||
export default function scn_starter(){ | ||
|
||
k.add([ | ||
k.rect(k.width(), k.height()), | ||
k.color(k.WHITE), | ||
]) | ||
|
||
k.add([ | ||
k.pos(k.center()), | ||
k.anchor("center"), | ||
k.color(k.BLACK), | ||
k.text("Hello, Kaplay!\nEdit The Files In The 'src' Folder To Get Started\nCheck Out https://kaplayjs.com For The Documentation", { | ||
align: "center", | ||
}), | ||
]); | ||
|
||
k.loadBean() | ||
|
||
let bean = k.add([ | ||
k.sprite("bean"), | ||
k.pos(k.width() / 2, k.height() / 2 + 200), | ||
k.anchor("center"), | ||
k.rotate(0), | ||
cmp_spin(), | ||
]) | ||
|
||
k.onFixedUpdate(() => { | ||
bean.pos.x = Math.cos(k.time()) * 100 + k.width() / 2 | ||
bean.pos.y = Math.sin(k.time()) * 100 + k.height() / 2 + 200 | ||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"isolatedModules": true, | ||
"moduleDetection": "force", | ||
"noEmit": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"] | ||
} |