1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- function CoinDestination(startx, starty, coinValue) {
- var position = {x : startx, y: starty};
- this.isConsumed = false;
- var value = coinValue;
- var delay = 25;
- this.init = function(canvas) {
- };
- this.update = function(canvas) {
- };
- this.draw = function(context, offset) {
- context.beginPath();
- context.strokeStyle = "#FFFF00";
- var size = 10 * (value + 1);
- var mid = size / 2;
- context.rect(position.x - mid, position.y - mid, size, size);
- context.stroke();
- };
- this.getPosition = function() {
- return position;
- }
- this.visit = function(hero) {
- hero.actionDelay(delay);
- hero.addCoin(Math.pow(10, value));
- this.isConsumed = true;
- return this;
- }
- this.getType = function() {
- return "coin";
- }
- this.mouseMove = function(canvas, x, y) {
- };
- this.getName = function() {
- return this.getType();
- }
- this.getLevel = function() {
- return value;
- }
- }
|