Skip to content

Commit

Permalink
Got the creature move as well check attack damage test. Remove some f…
Browse files Browse the repository at this point in the history
…unction for testing some to check dead conditions. Rework the help menu a bit.
  • Loading branch information
Lightnet committed Aug 13, 2017
1 parent d6d6d9d commit d5708b1
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 105 deletions.
1 change: 1 addition & 0 deletions SlimeDungeon.gmx/SlimeDungeon.project.gmx
Expand Up @@ -223,6 +223,7 @@
<scripts name="creature_script">
<script>scripts\scr_creature_attack.gml</script>
<script>scripts\scr_creature_return_spawn.gml</script>
<script>scripts\scr_creature_move_to_target.gml</script>
</scripts>
<scripts name="adventure_script">
<script>scripts\scr_move_to_dugeonexit.gml</script>
Expand Down
10 changes: 5 additions & 5 deletions SlimeDungeon.gmx/objects/obj_damage.object.gmx
Expand Up @@ -129,11 +129,11 @@ if (other.id != creator){
var dir = point_direction(x, y, other.x, other.y);
}

var xforce = lengthdir_x(knockback, dir);
var yforce = lengthdir_y(knockback, dir);
with(other){
physics_apply_impulse(x,y,xforce,yforce);
}
//var xforce = lengthdir_x(knockback, dir);
//var yforce = lengthdir_y(knockback, dir);
//with(other){
//physics_apply_impulse(x,y,xforce,yforce);
//}
}
</string>
</argument>
Expand Down
51 changes: 34 additions & 17 deletions SlimeDungeon.gmx/objects/obj_dungeon_status.object.gmx
Expand Up @@ -102,6 +102,20 @@ dung_floor_size[1] = 100;
//Stores the map of the current floor.


//help text
helpkeys[0] = "Dungeon Keys";
helpkeys[1] = "Tab Key | Camera Toggle";
helpkeys[2] = "B | Build Menu";
helpkeys[3] = "Q | Status Menu";
helpkeys[4] = "F2 | Debug Menu";
helpkeys[5] = "Mouse Wheel | Zome Camera";
helpkeys[6] = "Mouse Middle | Pan Camera";
helpkeys[7] = "";
helpkeys[8] = "Command Mode";
helpkeys[9] = "Left Mouse | Select Select Unit";
helpkeys[10] = "Right Mouse | Move Unit";


//setup tests!
scr_init_skills();
scr_init_items();
Expand Down Expand Up @@ -280,19 +294,22 @@ if(obj_input.dungeonmenu_key){

if(obj_input.f2_key){
//scr_getcreatures();
if(alarm[0] &lt;= 0){
//scr_roomobjects();
//scr_getcreaturescount();
//scr_getadventurercount();
if(instance_exists(obj_admin)){
if(obj_admin.bshow){
obj_admin.bshow = false;
}else{
obj_admin.bshow = true;
}
}
alarm[0] = room_speed / 6;
if(alarm[0] &lt;= 0){
if(instance_exists(obj_admin)){
if(obj_admin.bshow){
obj_admin.bshow = false;
}else{
obj_admin.bshow = true;
}
}
alarm[0] = room_speed / 6;
}
}

if(obj_input.help_key){
bhelpkey = true;
}else{
bhelpkey = false;
}


Expand Down Expand Up @@ -366,18 +383,18 @@ scr_getadventurercount();
<argument>
<kind>1</kind>
<string>/// @description Draw HUD
// You can write your code in this editor


//Fix when player death and presistent draw.
//show_debug_message(string(g_display_dungeon));
if(global._display_dungeon){
if(global._ishud){
if(global._ishud){
if(global._display_dungeon){
//script_execute(scr_dungeon_hud);
script_execute(dungeon_ui);
}
}

if(bhelpkey){
script_execute(scr_display_help_key);
}
</string>
</argument>
</arguments>
Expand Down
54 changes: 41 additions & 13 deletions SlimeDungeon.gmx/objects/obj_lifeform_parent.object.gmx
Expand Up @@ -29,15 +29,38 @@
if(object_get_physics(object_index)){
phy_fixed_rotation = true;
}
//base info creature status
hp = 3;
maxhp = 3;
mp = 0;
maxmp = mp;

level = 0;
experience = 0;
nextexperience = 10;
dpconvertrate = 10;//hp + mp / dpconvertrate = dp

//battle settings
attack = 0;
defense = 0;
magicattack = 0;
magicdefense = 0;


monsterTier = 1;
name = "testName";
spd = 1;
issnap = false;
isfixed = false;
objtype = VOID;

//paramse
name = "testname";
bsingle_select = false;
teamid = -1;
owner = "";
creator = "";

//health bar
bdisplay_healthbar = true;
bdisplay_hungerbar = true;
Expand All @@ -59,13 +82,7 @@ followTarget = instance_create(x,y,obj_follow_target);
followTarget.owner = self;
point = 0;
path_done = 0;

//paramse
name = "testname";
bsingle_select = false;
teamid = -1;
owner = "";
creator = "";
path = path_add();

//loyalty
loyalty = 50;
Expand Down Expand Up @@ -122,6 +139,17 @@ mineStrength = 10;
<kind>1</kind>
<string>/// delete stuff
//death_loyalty();
var dp = (maxhp + maxmp)/dpconvertrate;
show_debug_message("Dead dp:"+ string(dp))

//add dungeon poitns
obj_dungeon_status.dp += dp;

//delete path
if(path_exists(path)){
path_delete(path);
}

with(followTarget)
{
instance_destroy();
Expand Down Expand Up @@ -244,12 +272,13 @@ if ( hunger &lt;= 0) {
}

if(hp &lt;= 0){
var corpse = instance_create(x,y,obj_corpse_parent);
corpse.food = maxHunger/2;
corpse.sprite_index = death_sprite;
//var corpse = instance_create(x,y,obj_corpse_parent);
//corpse.food = maxHunger/2;
//corpse.sprite_index = death_sprite;
instance_destroy();
}
var corpse = collision_point(x,y,obj_corpse_parent,false,true);
//var corpse = collision_point(x,y,obj_corpse_parent,false,true);
/*
if (corpse &amp;&amp; alarm[11] &lt;= 0)
{
var eatAmount = max(0,min(maxHunger-hunger,corpse.food,maxHunger/10));
Expand All @@ -258,8 +287,7 @@ if (corpse &amp;&amp; alarm[11] &lt;= 0)
alarm[11] = 1*room_speed;
loyalty += 5;
}


*/
</string>
</argument>
</arguments>
Expand Down
22 changes: 14 additions & 8 deletions SlimeDungeon.gmx/objects/obj_monster_parent.object.gmx
Expand Up @@ -56,6 +56,7 @@ script_state = noone;
<kind>1</kind>
<string>/// @description Insert description here
// You can write your code in this editor
event_inherited();
obj_dungeon_status.alarm[2] = room_speed;
</string>
</argument>
Expand Down Expand Up @@ -89,17 +90,22 @@ inst = instance_nearest(x, y, obj_adventurer_parent);//works
//draw_line(x, y, 0, 0);
if inst != id
{
//draw_line(x, y, inst.x+8, inst.y+8);
if(distance_to_object(inst) &lt; 10){
script_state = scr_creature_attack;
}else{

}
//show_debug_message("Line?");
if(distance_to_object(inst) &lt; 32){
script_state = scr_creature_move_to_target;
}

//attack in range
//draw_line(x, y, inst.x+8, inst.y+8);
if(distance_to_object(inst) &lt; 10){
script_state = scr_creature_attack;
}else{

}
//show_debug_message("Line?");
}

if(script_state != noone){
script_execute(script_state);
script_execute(script_state);
}
</string>
</argument>
Expand Down
12 changes: 12 additions & 0 deletions SlimeDungeon.gmx/objects/obj_slime.object.gmx
Expand Up @@ -29,6 +29,18 @@
//phy_fixed_rotation = true;
event_inherited();

hp = 20;
maxhp = hp;
mp = 50;
maxmp = mp;

//battle settings
attack = 5;
defense = 0;
magicattack = 0;
magicdefense = 0;


hb_offset_x = -16;
hb_offset_y = -16;
hb_width = 32;
Expand Down
11 changes: 8 additions & 3 deletions SlimeDungeon.gmx/objects/obj_thief.object.gmx
Expand Up @@ -99,9 +99,9 @@ if inst != id
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObject>-1</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectShape>1</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
Expand All @@ -110,5 +110,10 @@ if inst != id
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
<PhysicsShapePoints>
<point>8,18</point>
<point>24,18</point>
<point>24,32</point>
<point>8,32</point>
</PhysicsShapePoints>
</object>
4 changes: 2 additions & 2 deletions SlimeDungeon.gmx/objects/obj_view.object.gmx
Expand Up @@ -110,8 +110,8 @@ if(bcameracontrol){
view_xview = drag_x - (mouse_x - view_xview);
view_yview = drag_y - (mouse_y - view_yview[0]);
//doesn't go outside view
view_xview = max(0,min(view_xview, room_width - view_wview));
view_yview = max(0,min(view_yview, room_height - view_hview));
//view_xview = max(0,min(view_xview, room_width - view_wview));
//view_yview = max(0,min(view_yview, room_height - view_hview));
//change cursor
window_set_cursor(cr_size_all);
//show_debug_message("drag? "+string(drag_x)+":"+string(drag_y));
Expand Down
48 changes: 24 additions & 24 deletions SlimeDungeon.gmx/scripts/scr_adventurer_attack.gml
Expand Up @@ -3,30 +3,30 @@ var inst,xx;
inst = instance_nearest(x, y, obj_monster_parent);//works
if inst != id
{
var dir = point_direction(x,y,inst.x,inst.y);
var dirx = lengthdir_x(32,dir);
var diry = lengthdir_y(32,dir);
if(alarm[10] <= 0){
//show_debug_message("DIR:"+string(dir));
//show_debug_message("HEALTH:"+string(hp));
//show_debug_message("HEALTH EMENY:"+string(inst.hp));
//show_debug_message(" POINT DIR:"+string(dirx) +":"+ string(diry));
dirx = x + dirx;
diry = y + diry;
//show_debug_message("DIR:"+string(dirx) +":"+ string(diry));
var damage = instance_create(dirx,diry, obj_damage);
//var damage = instance_create_layer(x,y,"effects", obj_damage);
//damage.sprite_index = //image draw
damage.creator = id;
//damage.damage = obj_player_stats.attack;
damage.damage = 5;
//attacked = true;
alarm[10] = room_speed *2;
}
var dir = point_direction(x,y,inst.x,inst.y);
var dirx = lengthdir_x(32,dir);
var diry = lengthdir_y(32,dir);

if(alarm[10] <= 0){
//show_debug_message("DIR:"+string(dir));
//show_debug_message("HEALTH:"+string(hp));
//show_debug_message("HEALTH EMENY:"+string(inst.hp));
//show_debug_message(" POINT DIR:"+string(dirx) +":"+ string(diry));
dirx = x + dirx;
diry = y + diry;

//show_debug_message("DIR:"+string(dirx) +":"+ string(diry));

var damage = instance_create(dirx,diry, obj_damage);
//var damage = instance_create_layer(x,y,"effects", obj_damage);
//damage.sprite_index = //image draw
damage.creator = id;
//damage.damage = obj_player_stats.attack;
damage.damage = attack;

//attacked = true;
alarm[10] = room_speed *2;
}
}


0 comments on commit d5708b1

Please sign in to comment.