eastern-flames/eastern flames/objects/o_unit/Create_0.gml

51 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-08-15 02:35:57 +00:00
//unitdata = new unit();
2022-08-15 04:06:41 +00:00
pos = new vec2(0, 0);
state = st_standing;
drawstate = c_null;
hspd = 0;
vspd = 0;
2022-08-15 04:36:37 +00:00
returnpos = new vec2(0, 0);
2022-08-16 01:01:09 +00:00
dir = DIR.NONE;
attacks = 0;
attacked = 0;
2022-08-16 03:25:26 +00:00
inventory = [];
c_addweapon(id, wp.nothing);
equippedweapon = noone;
2022-08-16 22:28:01 +00:00
waiting = false;
2022-08-18 20:47:07 +00:00
targeting = new vec2(0, 0);
2022-08-20 18:53:31 +00:00
hitpos = new vec2(0, 0);
2022-08-18 20:47:07 +00:00
marked = false;
2022-08-23 06:49:38 +00:00
hitting = noone;
2022-08-16 01:01:09 +00:00
continuecombat = function(me, them) {
//if stamina returnable = true stamina-- return true
2022-08-23 13:06:02 +00:00
if them.data.str.val < 0 || me.data.hp.val <= 0 {
return false;
}
2022-08-16 01:01:09 +00:00
if !(attacks-(me.data.spd.val > them.data.spd.val+5)) { //DONT USE FIVE, OR ANY OF THIS
attacks++;
return true;
}
return false;
}
action = {
effect: function(me, them) {
2022-08-23 08:34:45 +00:00
var guy = instance_create(them.x, them.y, o_damage);
guy.hspd = random(3)-1.5;
guy.vspd = -random(1)-3;
2022-08-16 22:28:01 +00:00
if irandom(99) < (me.data.hit.val) { //add avo
2022-08-23 13:06:02 +00:00
them.data.hp.val = min(them.data.hp.val - (me.data.str.val-them.data.def.val), them.data.hp.cap);
2022-08-23 08:34:45 +00:00
guy.amount = (me.data.str.val-them.data.def.val);
2022-08-16 22:28:01 +00:00
return me.data.str.val;
} else {
2022-08-23 08:34:45 +00:00
guy.amount = "Miss!";
2022-08-16 22:28:01 +00:00
return 0;
}
2022-08-16 01:01:09 +00:00
}
//animation: new actionanim()
}
2022-08-16 02:04:23 +00:00
image_speed = .15;
2022-08-16 01:01:09 +00:00
hooks = {};