-
Notifications
You must be signed in to change notification settings - Fork 15
Create a Skill
hugeen edited this page Nov 18, 2012
·
14 revisions
- Create a file for the Skill component:
/game/components/skills/skill_name.js
- Add it to components loading file:
/game/components.js
Your file should look like this:
define([
'Underscore',
'Crafty'
], function(_, Crafty) {
Crafty.c("SkillName", {
init : function() {
this.cast = function(options) {
// Do something here
}
}
});
});
- Add your icon (53*53) at the end of
/assets/images/skills.png
- Open
/game/skills.js
and add your skill
[{
name: "SkillName",
cooldown: 0.7,
action: function() {
Crafty.e("SkillName").cast(options);
},
backgroundPosition: "-53px 0"
}]
- Add a default key to
/game/keyboard.js
AZERTY: {
"SkillName": "Q",
},
QWERTY: {
"SkillName": "A",
},
QWERTZ: {
"SkillName": "A",
}