mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-09-10 11:50:28 +08:00
Refactored flame and bubbles
This commit is contained in:
@@ -74,29 +74,7 @@ var GameObjects = (function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
/** Run an experiment depending on ingredients and conditions **/
|
||||
Lab.prototype.experiment = function(options) {
|
||||
var elements = options.elements || [];
|
||||
var elementKeys = elements.map(function(e){return $(e).data('element')});
|
||||
elementKeys.sort(); // this makes reaction be independant of order
|
||||
|
||||
var result = this.rules[elementKeys]
|
||||
if (result) {
|
||||
this.reaction(result.ingredients,result.rune)
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/** Remove ingredients and make results with animations **/
|
||||
Lab.prototype.reaction= function(ingredients,results){
|
||||
// TODO put new rune in old position, add animations
|
||||
var rune = this.runeElem(r,$(aElem).parent().parent());
|
||||
$('#observationsContent').append('<div class="col-md-12">'+this.runes[a]+'+'+this.runes[b]+'='+this.runes[r]+'</div>')
|
||||
this.bubblr.start(1500);
|
||||
// TODO use jqueru ui transfer effect to remove or puff
|
||||
$(aElem).remove();
|
||||
$(bElem).remove();
|
||||
}
|
||||
Lab.prototype.buy = function(cost) {
|
||||
if (this.state.money >= cost) {
|
||||
this.state.money -= cost;
|
||||
|
||||
Reference in New Issue
Block a user