https://github.com/lukechinworth/adventurescript
Create an adventure game with assets and a config file
https://github.com/lukechinworth/adventurescript
framework point-and-click typescript
Last synced: about 2 months ago
JSON representation
Create an adventure game with assets and a config file
- Host: GitHub
- URL: https://github.com/lukechinworth/adventurescript
- Owner: lukechinworth
- Created: 2017-09-11T05:57:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-29T03:14:05.000Z (over 7 years ago)
- Last Synced: 2025-01-18T12:47:58.856Z (3 months ago)
- Topics: framework, point-and-click, typescript
- Language: TypeScript
- Homepage: https://lukechinworth.github.io/AdventureScript/
- Size: 365 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AdventureScript
The idea is to build an adventure game from a config file, e.g.
```
// adventure.json
{
scenes: [
{
id: 1,
image: '/img/scenes/start.jpg',
name: 'start',
message: 'You find yourself in a room with a chest, and a key in your pocket.',
clickables: [
{
image: '/img/clickables/chest.png',
use: {
id: 1,
fail: 'There is a key hole in the front of the chest.'
},
acquire: 2,
x: 100,
y: 120
},
{
image: '/img/scenes/start/clickables/door.png',
x: 400,
y: 220,
scene: 2
}
]
},
{
id: 2,
image: '/img/scenes/outside.jpg',
name: 'outside',
clickables: [
{
image: '/img/scenes/outside/path_1.png',
x: 100,
y: 120,
scene: 3
},
{
image: '/img/scenes/outside/path_2.png',
x: 500,
y: 120,
scene: 4
}
]
}
],
items: [
{
id: 1,
name: 'key',
image: '/img/items/key.png
},
{
id: 2,
name: 'sword',
image: '/img/items/sword.png,
message: 'You open the chest to find a steel sword.'
}
]
}
```## Assets
Backgrounds are static `jpg`s. Clickable areas are `png`s with transparent backgrounds. Clicks are registered when the png content (as opposed to the transparent background) is clicked, through the magic of [`getImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData).