@@ -0,0 +1,146 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>s_cursor</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>-500000</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>grid_x = global.mouse_grid_x;
grid_y = global.mouse_grid_y;


</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>// INI Mouse Pos
x = global.mouse_world_x;
y = global.mouse_world_y;

grid_x = global.mouse_grid_x;
grid_y = global.mouse_grid_y;




///// MOVEMENT

/// MOVE
if (mouse_check_button_pressed(mb_right)){
if (global.selected_actor != noone and global.hover_node.move_node == true) {

current = global.hover_node;

// create priority queue
path = ds_priority_create();

// Add Current node to queue
ds_priority_add(path, current, current.g_score);

// Step trhough each node parent to parent
while(current.parent != noone) {
// Add parent node to queue. Priority = to current parents gscore
ds_priority_add(path, current.parent, current.parent.g_score);

// Set current equal to current parent ready to go again
current = current.parent;

}

do {
// delete lowest priority node (closest to actors) store ID in current
current = ds_priority_delete_min(path);

// add current nodes sprite coords to selected actors path
path_add_point(global.selected_actor.movement_path, current.x, current.y, 100);


} until(ds_priority_empty(path));

// Clean Up queue
ds_priority_destroy(path);

// First clear node of selected actor
map[global.selected_actor.grid_x, global.selected_actor.grid_y].occupant = noone;

// Update Selected actros grid coords
global.selected_actor.grid_x = grid_x;
global.selected_actor.grid_y = grid_y;

// Update SElected actors future node
global.hover_node.occupant = global.selected_actor;

// Move Actor!
global.selected_actor.state = "begin path";

// reduce selected actors actions and wipe node
if (global.hover_node.g_score &gt; global.selected_actor.move) {
global.selected_actor.actions -= 2;
scr_wipe_nodes();
} else {
global.selected_actor.actions -= 1;
scr_wipe_nodes();
}

global.selected_actor = noone;

}
}

</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>
@@ -3,7 +3,7 @@
<spriteName>s_hex_2</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>0</depth>
<depth>100</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
@@ -25,12 +25,11 @@
<arguments>
<argument>
<kind>1</kind>
<string>// State
state = "initializing";

// Create DS List
<string>// Create DS List
neighbors = ds_list_create();

state = "initializing";

// Color
color = c_white;

@@ -41,12 +40,12 @@ world_x = x;
world_y = y;

// Vars
hover = false;
occupant = noone;
accessible = true;
type = "node"

type = "node";
current_actor = noone;
// Pathfinding Vars -----------------

parent = noone;
g_score = 0;
move_node = false;
@@ -76,87 +75,111 @@ cost = 1;
<arguments>
<argument>
<kind>1</kind>
<string>
o_player.actions = 2;
scr_movement_range(map[o_player.grid_x,o_player.grid_y], o_player.move, o_player.actions);


if (accessible == true and occupant == noone) {
if (mouse_check_button_pressed(mb_left)){
if grid_x == global.mouse_grid_x and grid_y = global.mouse_grid_y {

// Clear node
map[o_player.grid_x, o_player.grid_y].occupant = noone;

// Update Position
o_player.grid_x = grid_x;
o_player.grid_y = grid_y;
o_player.x = x;
o_player.y = y;

// Update actors new node
map[o_player.grid_x, o_player.grid_y].occupant = o_player.id;

// if selected actor perforemed double move deselect

if (o_player.g_score &gt; o_player.move) {
scr_wipe_nodes();
} else {
o_player.actions -= 1;

if (o_player.actions &gt; 0) {
//re-preform movement range
scr_movement_range(map[o_player.grid_x,o_player.grid_y], o_player.move, o_player.actions);
} else {
scr_wipe_nodes();
}

}


} else {
scr_wipe_nodes();
}
}
}

///// Replace Nodes

switch (state) {
<string>///// Replace Terrain
switch(state) {
case "initializing":
with (o_node) {
if (instance_position(x, y, o_terrain)) {

temp_terrain = instance_position(x, y, o_terrain);

switch (temp_terrain.type) {
with (o_node){
if (instance_position(x, y, o_terrain)) {
temp_terrain = instance_position(x, y, o_terrain);
switch(temp_terrain.type) {
case "sand":
type = "sand";
sprite_index = s_hex_2;
sprite_index = s_hex_sand;
accessible = true;
cost = 2;
break;

case "rock":
type = "rock";
sprite_index = s_hex_2;
sprite_index = s_hex_rock;
accessible = false;
break;

case "gap":
type = "gap";
sprite_index = s_hex_2;
accessible = false;
break;
}

with (temp_terrain) {
break;
}
with(temp_terrain) {
instance_destroy();
}
}

if (instance_position(x, y, o_actor)){
occupant = instance_position(x, y, o_actor);
occupant.grid_x = grid_x;
occupant.grid_y = grid_y;
}

}
state = "roll init";
break;

case "roll init":
temp_init = ds_priority_create();

with(o_actor) {
init_roll = irandom_range(1,20) + init;

ds_priority_add(other.temp_init, id, init_roll);
}

while(ds_priority_size(temp_init) &gt; 0) {
ds_list_add(global.turn_order, ds_priority_delete_max(temp_init));
}

global.turn_max = ds_list_size(global.turn_order);

// destroy list
ds_priority_destroy(temp_init);

state = "ready"
break;

case "ready":
if (current_actor == noone) {
// Turn counters
global.turn_counter += 1;
if (global.turn_counter &gt;= global.turn_max) {
global.turn_counter = 0
global.round_counter += 1;
}

current_actor = ds_list_find_value(global.turn_order, global.turn_counter);

current_actor.actions = 2;
global.selected_actor = current_actor;

scr_movement_range(map[current_actor.grid_x, current_actor.grid_y], current_actor.move, current_actor.actions);
}
state = "ready";
break;
}








</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="6" enumb="11">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>hover = false;
</string>
</argument>
</arguments>
@@ -179,9 +202,11 @@ switch (state) {
<arguments>
<argument>
<kind>1</kind>
<string>// Mouse Check
<string>/// Mouse Check / Hover Node
global.mouse_grid_x = grid_x;
global.mouse_grid_y = grid_y;
global.hover_node = map[grid_x, grid_y];
hover = true;
</string>
</argument>
</arguments>
@@ -209,7 +234,7 @@ global.mouse_grid_y = grid_y;
if global.devmode == true {
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_color(c_white);
draw_set_color(c_black);

// Grid x,y position
draw_text(x, y-35, string(grid_x) + " , " + string(grid_y));
@@ -284,7 +309,13 @@ if global.devmode == true {
<arguments>
<argument>
<kind>1</kind>
<string>draw_sprite_ext(sprite_index, -1, x, y, 1, 1, 0, color, 1);
<string>// Draw self and Hover.
if (hover == true) {
draw_sprite_ext(sprite_index, -1, x, y, 1, 1, 0, color, 1);
draw_sprite_ext(s_selected_2, -1, x, y, 1, 1, 0, c_white, 1);
} else {
draw_sprite_ext(sprite_index, -1, x, y, 1, 1, 0, color, 1);
}
</string>
</argument>
</arguments>
@@ -28,6 +28,46 @@
<string>event_inherited();

name = "player";
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if (global.hover_node != noone and global.hover_node != map[grid_x, grid_y]) {
current = global.hover_node;

// step through every node in the chain, parent to parent, until we reach the actor's node.
while(current.parent != noone){
draw_line_width_color(current.x, current.y, current.parent.x, current.parent.y, 4, c_red, c_red);

current = current.parent; // End While Loop

}
}


if global.selected_actor == id {
draw_sprite_ext(s_player,1,x,y,1,1,0,c_white,1)
} else {
draw_sprite_ext(s_player,0,x,y,1,1,0,c_white,1)
}
</string>
</argument>
</arguments>
@@ -1,19 +1,19 @@
/// scr_color_move_node(node ID, actor's move, actor's actions);

var node_id;
var node;
var move;
var actions;

node_id = argument0;
node = argument0;
move = argument1;
actions = argument2;

if (actions > 1) {
if (node_id.g_score > move) {
node_id.color = c_yellow;
if (node.g_score > move) {
node.color = c_yellow;
} else {
node_id.color = c_aqua;
node.color = c_aqua;
}
} else {
node_id.color = c_yellow;
node.color = c_yellow;
}
@@ -9,8 +9,8 @@ globalvar node_h; node_h = sprite_get_height(s_hex_2);
globalvar map_offset_x; map_offset_x = 320;
globalvar map_offset_y; map_offset_y = 220;

map_w = 10;
map_h = 7;
map_w = 13;
map_h = 9;

xPos = 0;

@@ -99,3 +99,6 @@ for (xx = 0; xx < map_w; xx += 1){
}
}
}

// Generate Terrain
scr_gen_terrain();
@@ -1,12 +1,10 @@
///scr_gen_terrain();

/*
// Gen Sand
repeat (10) {

rand_x = irandom_range(0, 9);
rand_y = irandom_range(0, 6);
rand_x = irandom_range(0, map_w-1);
rand_y = irandom_range(0, map_h-1);

with (instance_create(map[rand_x,rand_y].world_x, map[rand_x,rand_y].world_y, o_sand)) {
//grid_x = rand_x;
@@ -17,23 +15,14 @@ repeat (10) {
// Gen Rock
repeat (10) {

rand_x = irandom_range(0, 9);
rand_y = irandom_range(0, 6);
rand_x = irandom_range(0, map_w-1);
rand_y = irandom_range(0, map_h-1);

with (instance_create(map[rand_x,rand_y].world_x, map[rand_x,rand_y].world_y, o_rock)) {
//grid_x = rand_x;
//grid_y = rand_y;
}
}

// Gen Gaps
repeat (5) {

rand_x = irandom_range(0, 9);
rand_y = irandom_range(0, 6);
with (instance_create(map[rand_x,rand_y].world_x, map[rand_x,rand_y].world_y, o_gap)) {
//grid_x = rand_x;
//grid_y = rand_y;
}
}

@@ -28,7 +28,7 @@ ds_priority_add(open, start, start.g_score);

// While opne queue is NOT empty...
// repeat the following until ALL nodes have been looked at
while (ds_priority_size(open) > 0) {
while(ds_priority_size(open) > 0) {

// remove node with the lowest G score from open
current = ds_priority_delete_min(open);
@@ -59,12 +59,10 @@ while (ds_priority_size(open) > 0) {
// give neighbor appropriate parent
neighbor.parent = current;

/*
// if node is diag create appropriate cost mod (Not sure if use for Hex's
// if node is diag create appropriate cost mod (Not sure if use for Hex's)
if (neighbor.grid_x != current.grid_x and neighbor.grid_y != current.grid_y) {
cost_mode = 1.5;
}
*/

// Calc G score of neighbor, with cost mod in place
neighbor.g_score = current.g_score + (neighbor.cost + cost_mod);
@@ -78,12 +76,11 @@ while (ds_priority_size(open) > 0) {
// Figure out if the neighbors score would be LOWER if found from the current node!
cost_mod = 1;

/*

// if node is diag create appropriate cost mod (Not sure if use for Hex's
if (neighbor.grid_x != current.grid_x and neighbor.grid_y != current.grid_y) {
cost_mode = 1.5;
}
*/

temp_g_score = current.g_score + (neighbor.cost * cost_mod);

@@ -118,10 +115,12 @@ ds_priority_destroy(open);
for (ii = 0; ii < ds_list_size(closed); ii +=1) {
current = ds_list_find_value(closed, ii);
current.move_node = true;

scr_color_move_node(current, argument1, argument2);
}

start.move_node = false;
start.color = c_white;

// Destroy Closed List!! IMPORTANT!
ds_list_destroy(closed);

@@ -2,7 +2,7 @@

// reset data of all nodes

with (o_node) {
with(o_node) {
move_node = false;
g_score = 0;
parent = noone;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>0</yorigin>
<colkind>2</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>2</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>1</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>1</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>30</width>
<height>30</height>
<frames>
<frame index="0">images\s_cursor_0.png</frame>
</frames>
</sprite>
@@ -3,10 +3,10 @@
<type>0</type>
<xorig>47</xorig>
<yorigin>54</yorigin>
<colkind>1</colkind>
<colkind>0</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bboxmode>2</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>93</bbox_right>
<bbox_top>0</bbox_top>
@@ -1,24 +1,24 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>60</xorig>
<yorigin>70</yorigin>
<colkind>1</colkind>
<xorig>47</xorig>
<yorigin>54</yorigin>
<colkind>0</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>119</bbox_right>
<bbox_right>93</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>139</bbox_bottom>
<bbox_bottom>107</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>120</width>
<height>140</height>
<width>94</width>
<height>108</height>
<frames>
<frame index="0">images\s_hex_rock_0.png</frame>
</frames>
@@ -1,24 +1,24 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>60</xorig>
<yorigin>70</yorigin>
<colkind>1</colkind>
<xorig>47</xorig>
<yorigin>54</yorigin>
<colkind>0</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>119</bbox_right>
<bbox_right>93</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>139</bbox_bottom>
<bbox_bottom>107</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>120</width>
<height>140</height>
<width>94</width>
<height>108</height>
<frames>
<frame index="0">images\s_hex_sand_0.png</frame>
</frames>
@@ -21,5 +21,6 @@
<height>50</height>
<frames>
<frame index="0">images\s_player_0.png</frame>
<frame index="1">images\s_player_1.png</frame>
</frames>
</sprite>
@@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>47</xorig>
<yorigin>54</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>93</bbox_right>
<bbox_top>2</bbox_top>
<bbox_bottom>107</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>94</width>
<height>108</height>
<frames>
<frame index="0">images\s_selected_2_0.png</frame>
</frames>
</sprite>