Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Commit

Permalink
variable xp drops
Browse files Browse the repository at this point in the history
  • Loading branch information
darkf committed Feb 11, 2013
1 parent 764293c commit 1510270
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions main.ts
Expand Up @@ -56,15 +56,17 @@ class Actor implements Tile {
maxMana : number = 100;
health : number = 100;
mana : number = 100;
xpDropped : number = 25;
level : number;
baseXPDrop : number = 25;
alive : bool = true;
spell : Spell = new Slash();
spells : Spell[] = [];
effectImg : heart.HeartImage = null;

constructor(x:number) {
constructor(x:number, level:number=1) {
this.x = x;
this.spells = [this.spell];
this.level = level;
}

isSolid() { return this.alive }
Expand All @@ -83,7 +85,6 @@ class Actor implements Tile {

die() {
this.alive = false;
player.gainXP(this.xpDropped);
// todo: drops
}

Expand Down Expand Up @@ -126,8 +127,17 @@ class Actor implements Tile {
}

class Enemy extends Actor {
constructor(x:number) {
super(x);
constructor(x:number, level:number=1) {
super(x, level);
}

getXPDropped() {
return this.level * this.baseXPDrop
}

die() {
super.die();
player.gainXP(this.getXPDropped());
}

turn() {
Expand Down Expand Up @@ -287,7 +297,6 @@ class Player extends Actor {
x : number = 0;
img : heart.HeartImage = null;
xp : number = 975;
level : number = 1;
upgradePoints : number = 1;

constructor() {
Expand Down Expand Up @@ -476,7 +485,7 @@ function distance(x1:number, x2:number) {

var player = new Player();
var _home = new MapParser("home", " F U D ");
var _mapone = new MapParser("mapone", " $ U $ $ U D ");
var _mapone = new MapParser("mapone", " U $ $ $ U D ");
var map = _mapone;
var camera = new Camera();
var gameStates : GameState[] = [new PlayState()];
Expand Down

0 comments on commit 1510270

Please sign in to comment.