Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/basselin/impactjs-cheat-codes
:black_joker: CheatCodes is a simple plugin that can make cheat codes easily in ImpactJS during the game.
https://github.com/basselin/impactjs-cheat-codes
cheat-codes game impactjs javascript
Last synced: about 2 months ago
JSON representation
:black_joker: CheatCodes is a simple plugin that can make cheat codes easily in ImpactJS during the game.
- Host: GitHub
- URL: https://github.com/basselin/impactjs-cheat-codes
- Owner: basselin
- License: mit
- Created: 2014-02-09T09:40:09.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-25T18:49:16.000Z (almost 11 years ago)
- Last Synced: 2023-08-12T06:41:27.228Z (over 1 year ago)
- Topics: cheat-codes, game, impactjs, javascript
- Language: JavaScript
- Homepage:
- Size: 151 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Make Cheat Codes in your ImpactJS game
CheatCodes is a simple plugin that can make cheat codes easily in ImpactJS during the game.
## Usage
### First example
Copy **cheat-codes.js** to your **lib/plugins/** directory.Edit **lib/game/main.js** :
```javascript
ig.module(
'game.main'
)
.requires(
// ... ,
'plugins.cheat-codes',
// ...
)
.defines(function(){
MyGame = ig.Game.extend({
// ...
cheats: new ig.CheatCodes(),
// ...
init: function() {
// All weapons !
this.cheats.addCode('IDKFQ',
[ ig.KEY.I, ig.KEY.D, ig.KEY.K, ig.KEY.F, ig.KEY.Q ],
function() {
ig.game.myEntityPlayer.weaponBullets = 99999;
});
// ...
},
// ...
});
});
```### Cheat code for single use
```javascript
this.cheats.addCode('IDDAD',
[ig.KEY.I, ig.KEY.D, ig.KEY.D, ig.KEY.A, ig.KEY.D],
function() {
this.cheats.removeCode( 'IDDAD' );
// Your code for this cheat
});
```## Documentation
### Methods
* **addCode**: Add a cheat code.
* *name*: `String` Name of cheat.
* *keys*: `Array` Array of keys. See: `ig.KEY.`.
* *success*: `Function` Attach a function when the code is correct. The value of `ig.game` provided for the call to `success`.
* **removeCode**: Remove a cheat code.
* *name*: `String` Name of cheat.
* **removeAllCodes**: Remove all the cheat codes.## Changelog
**Version 1.0.1**
* Optimization**Version 1.0**
* First commit