Compare commits

...

2 Commits

Author SHA1 Message Date
Dan Buch 09ee33a751
idklol
7 months ago
Dan Buch ee9fb1955c
Is it cat town? perhaps
1 year ago

@ -0,0 +1,3 @@
/node_modules/
/src/*.js
/dist/

File diff suppressed because it is too large Load Diff

@ -0,0 +1,30 @@
{
"name": "cat-town",
"version": "0.1.0",
"private": true,
"main": "index.js",
"scripts": {
"webpack": "webpack",
"dev": "webpack serve --config webpack.development.js",
"start": "npm run dev",
"build:dev": "webpack --config webpack.development.js",
"build:prod": "webpack --config webpack.production.js"
},
"devDependencies": {
"@excaliburjs/testing": "^0.25.1",
"clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^7.1.2",
"html-webpack-plugin": "^5.5.0",
"source-map-loader": "^2.0.2",
"terser-webpack-plugin": "^5.3.6",
"ts-loader": "^9.4.2",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0"
},
"dependencies": {
"excalibur": "^0.27.0"
}
}

@ -0,0 +1,17 @@
import { Actor, Color, vec } from 'excalibur'
import { Resources } from '../resources'
export class Player extends Actor {
constructor() {
super({
pos: vec(150, 150),
width: 25,
height: 25,
color: new Color(255, 100, 100)
})
}
onInitialize() {
this.graphics.use(Resources.Cat.toSprite())
}
}

@ -0,0 +1,16 @@
// type Cat = {
// name string;
// years int;
// centimeters int;
// kilograms int;
// coloring Coloring;
// pattern Pattern;
// mood Mood;
// };
//
// type Coloring = 'orange' | 'black' | 'brown' | 'blue';
//
// type Pattern = 'plain' | 'striped' | 'spotted';
//
// type Mood = 'happy' | 'sad' | 'purring' |
// 'screaming' | 'mad' | 'scratchy' | 'curious' | 'concerned';

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

@ -0,0 +1,30 @@
import { Engine, Loader, DisplayMode } from 'excalibur'
import { Beginning } from './scenes/beginning'
import { Player } from './actors/player'
import { Resources } from './resources'
class Game extends Engine {
private player: Player
private beginning: Beginning
constructor() {
super({ displayMode: DisplayMode.FitScreen })
}
public start() {
this.beginning = new Beginning()
this.player = new Player()
this.beginning.add(this.player)
game.add('beginning', this.beginning)
const loader = new Loader(Object.values(Resources))
return super.start(loader)
}
}
const game = new Game()
game.start().then(() => {
game.goToScene('beginning')
})

@ -0,0 +1,8 @@
import { ImageSource } from 'excalibur'
import catImage from './images/cat.png'
const Resources = {
Cat: new ImageSource(catImage)
}
export { Resources }

@ -0,0 +1,7 @@
import { Engine, Scene } from 'excalibur'
export class Beginning extends Scene {
public onInitialize(engine: Engine) {}
public onActivate() {}
public onDeactivate() {}
}

@ -0,0 +1,22 @@
// type Town = {
// grid Grid;
// };
//
// type Grid = {
// squares Map<Coords, Square>;
// };
//
// type Coords = {
// x int;
// y int;
// };
//
// type Square = {
// description string;
// things Map<string, Thing>;
// };
//
// type Thing = {
// name string;
// description string;
// };

@ -0,0 +1,14 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"sourceMap": true,
"target": "es2017",
"module": "es6",
"types": ["excalibur"],
"outDir": "./dist/",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
}
}

@ -0,0 +1,47 @@
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index.ts",
target: "web",
output: {
filename: '[name].js',
sourceMapFilename: "[file].map",
path: path.resolve(__dirname, "dist"),
},
devtool: "source-map",
module: {
rules: [
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource"
},
{
test: /\.js$/,
use: ["source-map-loader"],
exclude: [path.resolve(__dirname, "node_modules/excalibur")],
enforce: "pre",
},
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
optimization: {
splitChunks: {
chunks: "all",
},
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebPackPlugin({
title: "Cat Town",
}),
],
};

@ -0,0 +1,12 @@
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
module.exports = merge(common, {
mode: "development",
devtool: "inline-source-map",
devServer: {
static: {
directory: "./dist",
},
},
});

@ -0,0 +1,13 @@
const { merge } = require("webpack-merge");
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const common = require("./webpack.common");
module.exports = merge(common, {
mode: "production",
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
plugins: [new CompressionWebpackPlugin()],
});
Loading…
Cancel
Save