Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Now, robots take their closest enemy as a target #46

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3489cea
initial playground
ropilz Nov 5, 2016
a4e92fd
Set project structure
ropilz Nov 6, 2016
848ef94
Update tooling
ropilz Nov 6, 2016
cfb471f
Fix github pages System base URL
ropilz Nov 6, 2016
bb8de60
Change tooling to webpack
ropilz Nov 7, 2016
d5f9b66
Add initial level loader
ropilz Nov 7, 2016
5ce5706
Add GameCanvas & GameLoop classes
ropilz Nov 8, 2016
cd0e3a5
Set minimun scale
ropilz Nov 8, 2016
a3b8c5c
Add character movement
ropilz Nov 8, 2016
747081f
import pixi
ropilz Nov 8, 2016
179e5dc
Add game monitoring
ropilz Nov 9, 2016
1075103
Add gh-pages build script
ropilz Nov 9, 2016
980b0f4
Refactor game
ropilz Nov 9, 2016
ec3bbf2
Add initial map collision detection
ropilz Nov 9, 2016
6eb62ea
Add ranged initial version
ropilz Nov 9, 2016
eea5a28
Prevent ranged from blocking LOS
ropilz Nov 10, 2016
1998290
Add ranged shoots
ropilz Nov 10, 2016
a2363f5
Make ranged walls on move collision detection
ropilz Nov 10, 2016
03d0df5
Add energyBall player collision
ropilz Nov 11, 2016
e206ff9
Add on blur pause
ropilz Nov 11, 2016
f4af4ec
Refactor entities code
ropilz Nov 11, 2016
72f4c94
Refactor entities II
ropilz Nov 11, 2016
371b8a9
Add body drawing to Map
ropilz Nov 12, 2016
4e7fc53
Add Wall entity
ropilz Nov 12, 2016
f9d7277
Add ranged hacking
ropilz Nov 12, 2016
3071115
Update readme
ropilz Nov 12, 2016
638f9e8
Update README.md
ropilz Nov 14, 2016
cdde2d5
Refactor Entity
ropilz Nov 17, 2016
746629a
Set closest enemy as robots target
depilz Nov 24, 2016
572691f
Now melee moves around the map loocking for a target
depilz Nov 25, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/dist
96 changes: 11 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,20 @@
# GitHub Game Off 2016
# Hacker vs Robots

![GitHub Game Off 2016 Theme is Hacking, Modding, or Augmenting](https://cloud.githubusercontent.com/assets/121322/19498019/d8827370-9543-11e6-82d8-6da822b6147b.png)
Game entry for the [Game Off 2016][ggo16]

<div align="right">
<sup>
<a href="#the-challenge">English</a> ·
<a href="#お題">日本語</a>
</sup>
</div>
Use your hacking abilities to neutralize all robots.

## The Challenge
## How to play

You have the entire month of November to create a game *loosely* based on the theme **hacking, modding and/or augmenting**.
Game can be played at https://ropilz.github.io/game-off-2016/. Move the hacker with ↑, ↓, ← and →. Get close to an
enemy unit to start hacking it. Neutralize all robots to win!

What do we mean by **loosely** based on hacking, modding and/or augmenting? We literally mean, *loosely* based. Some examples might be:
Found a bug? [create an issue][hvs-issues] we will be glad about it :).

* an endless runner where you *hack* down binary trees in your path with a pixelated axe,
* a *modern* take on a classic e.g. a roguelike set in a 3D or VR world, or
* an *augmented* reality game bringing octopus/cat hybrids into the real world.
## How to contribute

Unleash your creativity. You can work alone or with a team and build for any platform or device. The use of open source game engines and libraries is encouraged but not required.

We'll highlight some of our favorites on the GitHub blog, and the world will get to enjoy (and maybe even contribute to and/or learn from) your creations.

## How to participate

* [Sign up for a free personal account][github-signup] if you don't already have one.
* Fork [this repository][game-off-repo] to your personal account (or to a [free organization account][github-signup-org]).
* Clone the repository on your computer and build your game.
* Push your game source code to your forked repository before Dec 1st.
* Update the `README.md` file to include a description of your game, how/where to play/download it, how to build/compile it, what dependencies it has, etc.
* Submit your final game using this [form][wufoo-form].

## It's dangerous to go alone <img src="https://octodex.github.com/images/linktocat.jpg" height="40">

If you're **new to Git, GitHub, or version control**…

* [Git Documentation](https://git-scm.com/documentation) - everything you need to know about version control, and how to get started with Git.
* [GitHub Help](https://help.github.com/) - everything you need to know about GitHub.
* Questions about GitHub? Please [contact our Support team][github-support] and they'll be delighted to help you.
* Questions specific to the GitHub Game Off? Please [create an issue][game-off-repo-issues]. This will be the official FAQ.

The official Twitter hashtag for the Game Off is `#ggo16`. We look forward to playing with your creations.

GLHF! <3

## お題

11月いっぱいを使って、ゲームを作ってください。作ってもらいたいゲームのテーマは大まかに言って、**hacking, modding and/or augmenting(ハック、改造もしくは拡張)**です。

"**大まか**に言ってhacking, modding and/or augmenting(ハック、改造もしくは拡張)"とはどういう意味でしょうか? 文字通り、*大まか*にテーマに沿っていればいいということです。

例えば、こんな例も含まれるということです:

* ピクセル製の斧をつかってあなたが*叩き切った*(*hack* down)バイナリツリー上をランナーが走り続けるゲームとか
* ゲームの古典をベースに*現代的*(*modern*)な解釈をするとか(例えばローグライクゲームを3DやVRの世界で再現してみる)
* タコと猫のハイブリッドを現実世界に持ち込むような*拡張*現実(*augmented* reality)ゲームとか

みなさんのクリエイティビティを最大限発揮できるように、1人で作業してもチームで作業しても問題ありませんし、作るゲームがどんなプラットフォーム向けでもどんなデバイス向けでも不問とします。また、オープンソースのゲームエンジンやライブラリを使用することは歓迎しますが、必須ではありません。

ご応募いただいたゲームのうちいくつかはGitHubのブログで取り上げる予定です。世界中があなたが作ったゲームを楽しんでくれると思います。(そしてあなたのゲームに対して貢献もしてくれるかもしれませんし、同時にあなたのゲームから何かを学び取ることもあるでしょう)

## 参加方法

* まだGitHubのアカウントを持っていない場合、[GitHubにサインアップしてアカウントを作ってください。(無料のもので問題ありません)][github-signup]
* [このリポジトリ][game-off-repo]を自分のアカウントにフォークしてください。(もしくは[オーガニゼーションにフォークしても問題ありません。もちろん無料プランでいいです。][github-signup-org])
* 自身のコンピュータにリポジトリをクローンして、ゲームを開発してください。
* ゲームのソースコードをフォークした自分のリポジトリに12月1日になる前にプッシュしてください。
* `README.md`ファイルを更新して、ゲームの説明、プレイの仕方、ダウンロードの仕方、またはビルド/コンパイルの方法、依存しているライブラリ等の説明、等々、必要な情報を含めてください。
* 最後にこの[フォーム][wufoo-form]を使ってゲームをサブミットしてください。

## ヒトリデハキケンジャ コレヲ サズケヨウ <img src="https://octodex.github.com/images/linktocat.jpg" height="40">

もし**GitやGitHub、バージョン管理そのものについて初心者なのであれば**...

* [Git Documentation](https://git-scm.com/documentation) - バージョンコントロールについてと、Gitを使い始めるために必要な情報はここにあります。(日本語で読める情報としては[Pro Gitの日本語版](https://git-scm.com/book/ja/v2)があります)
* [GitHub Help](https://help.github.com/) - GitHubについてはこちらを参照してください。
* GitHubについて質問したいことがあれば、ぜひ[ここから問い合わせてください!(ただし英語でお願いします :bow: )][github-support] サポートチームが助けてくれます。
* GitHub Game Offに関する質問については、[ここにIssueを作って聞いてください。(英語でお願いします)][game-off-repo-issues]. これが公式のFAQになっていく予定です。

このGame OffのためのTwitterの公式ハッシュタグは`#ggo16`です。皆さんのゲームで遊べるのを楽しみにしています。

GLHF! <3
Fork this repo and run `yarn install` or `npm install` at the root of the project to install all dependencies, then run `npm start` and you will have the game running locally 🎉.

<!-- links -->
[game-off-repo]: https://github.com/github/game-off-2016/
[game-off-repo-issues]: https://github.com/github/game-off-2016/issues
[git-documentation]: https://git-scm.com/documentation
[github-help]: https://help.github.com/
[github-signup]: https://github.com/signup/free
[github-signup-org]: https://github.com/organizations/new
[github-support]: https://github.com/contact?form%5Bsubject%5D=GitHub%20Game%20Off
[wufoo-form]: https://gameoff.wufoo.com/forms/game-off-2016/
[ggo16]: http://gameoff.github.com/
[hvs-issues]: https://github.com/ropilz/game-off-2016/issues
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "game-off-2016",
"version": "1.0.0",
"description": "Game for Github Gameoff 2016",
"main": "dist/index.html",
"scripts": {
"build": "webpack -p",
"start": "webpack-dev-server"
},
"repository": {
"url": "git+https://github.com/ropilz/game-off-2016.git",
"type": "git"
},
"keyworkds": [
"ggo16",
"game off"
],
"author": "ropilz",
"license": "MIT",
"bugs": {
"url": "https://github.com/ropilz/game-off-2016/issues"
},
"dependencies": {
"@types/chai": "^3.4.34",
"clean-webpack-plugin": "^0.1.14",
"copy-webpack-plugin": "^4.0.0",
"html-webpack-plugin": "^2.24.1",
"pixi.js": "^4.1.1",
"rxjs": "^5.0.0-rc.2",
"stats.js": "^0.17.0",
"ts-loader": "^1.0.0",
"typescript": "^2.0.7",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.10"
}
}
17 changes: 17 additions & 0 deletions scripts/build-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /bin/bash

branch=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`

if [ $branch == 'master' ]
then
rm -rf dist
npm run build
message=`git log -1 --pretty=%B`
git checkout gh-pages || exit 1
find . ! -name 'node_modules' ! -name 'dist' ! -name '.*' -maxdepth 1 | xargs rm -rf
cp -r dist/* .
rm -rf dist
git add .
git commit -a -m "$message"
git checkout master
fi
Binary file added src/assets/basics/nin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export const config = {
tileSize: 32,
gridWidth: 20,
gridHeight: 15,
roundScale: true,
minScale: 0.5,
drawBodies: false,
drawView: true,
keys: {
'up': 38,
'right': 39,
'down': 40,
'left': 37,
'action': 32,
'confirm': 13
},
entities: {
player: {
speed: 2,
size: 24,
hackDistance: 20,
hackSpeed: 10
},
ranged: {
radius: 32 * 4,
size: 32,
shootDelay: 100,
shootCooldown: 200,
hackMeter: 50
},
melee: {
size: 30,
maxWalkDistance: 64 * 4,
minWalkDistance: 32,
speed: 1,
},
energyBall: {
size: 20,
speed: 2,
damage: 10
}
}
};
7 changes: 7 additions & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
margin: 0;
position: fixed;
}
canvas {
image-rendering: pixelated;
}
65 changes: 65 additions & 0 deletions src/game/entities/energyBall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import {Graphics, Rectangle, Point} from 'pixi.js';
import {IEntity, teamType} from '../types';
import {ITimeEvent} from '../game-loop';
import {config} from '../../config';
import {
normalizeVector,
isOutOfBOunds,
wallCollision,
enemyCollision
} from '../functional';


import {Unit} from './unit';

export class EnergyBall extends Unit {
get type() { return 'energyBall'; }
get team(): teamType { return 'robot'; }

private _speed: Point;
private _config: any;
get hitbox() { return this.body; }

_initBody() {
return new Rectangle(0, 0, this._config.size, this._config.size);
}

_initView() {
return new Graphics()
.beginFill(0xFFFFFF)
.drawCircle( 0, 0, this._config.size / 2);
}

_preInit() {
this._config = Object.assign(config.entities.energyBall);
}

update(time: ITimeEvent) {
let enemy = enemyCollision(this._game.currentMap, this);
if (
isOutOfBOunds(this._game.currentMap, this.body) ||
wallCollision(this._game.currentMap, this.body) ||
enemy !== null
) {
if (enemy) {
enemy.hit(this._config.damage);
}
this.destroy();
} else if (this._speed) {
this.position = new Point(
this.position.x + this._speed.x,
this.position.y + this._speed.y,
);
}
}

setTarget(targetPosition: Point) {
let position = this.position;
this._speed = normalizeVector(
targetPosition.x - position.x,
targetPosition.y - position.y
);
this._speed.x = this._speed.x * this._config.speed;
this._speed.y = this._speed.y * this._config.speed;
}
}
5 changes: 5 additions & 0 deletions src/game/entities/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './player';
export * from './ranged';
export * from './energyBall';
export * from './wall';
export * from './melee';
Loading