turnstates
This commit is contained in:
parent
1a13781220
commit
cd85677efd
57 changed files with 1813 additions and 104 deletions
|
@ -16,6 +16,7 @@ global.gw = 640;
|
|||
global.gh = 360;
|
||||
global.camerax = 0;
|
||||
global.cameray = 0;
|
||||
state = st_control;
|
||||
//these are functions bc c_2dto3d uses them
|
||||
function getProj(){
|
||||
return matrix_build_projection_perspective_fov(60,-16/9,1,4000)
|
||||
|
@ -49,4 +50,6 @@ models = [];
|
|||
|
||||
//var spr = sprite_add("./shrine thing tex.png",0,false,false,0,0);
|
||||
var spr = sprite_add("./Map 1/MapAtlas.png",0,false,false,0,0);
|
||||
nu Model("./Map 1/Map 1.dat",spr);
|
||||
nu Model("./Map 1/Map 1.dat",spr);
|
||||
|
||||
textbox_create(txt_test);
|
|
@ -1,88 +1 @@
|
|||
while global.turn == ARMY.THEM {
|
||||
var done = true;
|
||||
for (k=0; k<array_length(global.units[ARMY.THEM]); k++) {
|
||||
var target = global.units[ARMY.THEM][k];
|
||||
if !target.waiting {
|
||||
done = false;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
c_doenemyai(target);
|
||||
}
|
||||
if done {
|
||||
c_dewait(global.turn);
|
||||
global.turn = (global.turn+1)%2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
c_input();
|
||||
var mouse = c_2dto3d(mouse_x,mouse_y);
|
||||
if select && selectedunit == noone {
|
||||
var mousex = floor(mouse.x/global.tilesize.x);
|
||||
var mousey = floor(mouse.y/global.tilesize.y);
|
||||
log(mousex, mousey);
|
||||
if mousex < array_length(global.map) && mousex >= 0 {
|
||||
if mousey < array_length(global.map[mousex]) && mousey >= 0 {
|
||||
var i;
|
||||
for (i=0; i<array_length(global.map[mousex][mousey].contents); i++) {
|
||||
if global.map[mousex][mousey].contents[i].object_index == o_unit {
|
||||
var dude = global.map[mousex][mousey].contents[i];
|
||||
if dude.alignment == global.turn {
|
||||
c_selectunit(dude);
|
||||
} else {
|
||||
c_markunit(dude);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if select {
|
||||
if mouse.x > global.gw-100 {
|
||||
var guyhits = floor(abs(mouse.y-global.gh-10)/32);
|
||||
log(guyhits, array_length(selectedunit.inventory));
|
||||
if guyhits < array_length(selectedunit.inventory) {
|
||||
//log("doing");
|
||||
selectedunit.equippedweapon = guyhits+1;
|
||||
c_equipweapon(selectedunit, selectedunit.inventory[selectedunit.equippedweapon]);
|
||||
}
|
||||
//draw_text(global.gw-10, global.gh-10-i*20;
|
||||
}
|
||||
}
|
||||
if selectedunit == noone {
|
||||
hspd = lerp(hspd, (right-left)*((.1+stop*.1)*(ts.x)), .4);
|
||||
vspd = lerp(vspd, (down-up)*((.1+stop*.1)*(ts.y)), .4);
|
||||
x += hspd;
|
||||
y += vspd;
|
||||
|
||||
} else {
|
||||
hspd = 0;
|
||||
vspd = 0;
|
||||
x = lerp(x, selectedunit.x, .4);
|
||||
y = lerp(y, selectedunit.y, .4);
|
||||
}
|
||||
|
||||
global.camerax = x;
|
||||
global.cameray = y;
|
||||
var mousex = floor(mouse.x/global.tilesize.x);
|
||||
var mousey = floor(mouse.y/global.tilesize.y);
|
||||
//log(mousex, mousey);
|
||||
hoveredunit = selectedunit;
|
||||
if mousex < array_length(global.map) && mousex >= 0 {
|
||||
if mousey < array_length(global.map[mousex]) && mousey >= 0 {
|
||||
var i;
|
||||
for (i=0; i<array_length(global.map[mousex][mousey].contents); i++) {
|
||||
if global.map[mousex][mousey].contents[i].object_index == o_unit {
|
||||
hoveredunit = (global.map[mousex][mousey].contents[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i=0; i<array_length(global.units[global.turn]); i++) {
|
||||
if global.units[global.turn][i].waiting = false exit;
|
||||
}
|
||||
c_dewait(global.turn);
|
||||
global.turn = (global.turn+1)%2;
|
||||
log("TURN " + string(global.turn));
|
||||
state();
|
50
eastern flames/objects/o_textbox/Create_0.gml
Normal file
50
eastern flames/objects/o_textbox/Create_0.gml
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*if instance_exists(o_uicontroller) {
|
||||
o_uicontroller.UIElements = [];
|
||||
global.MenuCursor.disabled = true;
|
||||
}
|
||||
*/
|
||||
txtprocessed = false;
|
||||
keyboard_check_advanced = keyboard_check;
|
||||
msgscript = txt_test;
|
||||
name = "";
|
||||
clr = c_white;
|
||||
//draw_set_font(fm_couriernewreallybig);
|
||||
msg = [txt()];
|
||||
talkspeed = .5;
|
||||
endevent = c_null;
|
||||
talkchars = [];
|
||||
|
||||
width = 20;
|
||||
height = 20;
|
||||
spriteposx = 0;
|
||||
spriteposy = 0;
|
||||
talker = [new talkchar()];
|
||||
talkindex = [0, 0, 0, 0, 0];
|
||||
count = 0;
|
||||
|
||||
waiting = 0;
|
||||
waited = array_create(20);
|
||||
pressing = 0;
|
||||
pressed = array_create(20);
|
||||
wait = 0;
|
||||
wigglex = 0;
|
||||
wiggley = 0;
|
||||
shake = 0;
|
||||
selecting = false;
|
||||
skipped = false;
|
||||
specialchars = 0;
|
||||
didsounds = array_create(999);
|
||||
didfuncs = array_create(999);
|
||||
atsound = 0;
|
||||
atfunc = 0;
|
||||
backlogging = false;
|
||||
font = ft_couriernew;
|
||||
backlog = [];
|
||||
|
||||
nvlline = 0;
|
||||
|
||||
bg = s_null;
|
||||
|
||||
drawstates = [st_textadv, st_textnvl];
|
||||
|
||||
halting = false;
|
5
eastern flames/objects/o_textbox/Draw_64.gml
Normal file
5
eastern flames/objects/o_textbox/Draw_64.gml
Normal file
|
@ -0,0 +1,5 @@
|
|||
if txtprocessed {
|
||||
drawstates[texttype]();
|
||||
}
|
||||
//draw_sprite_at()
|
||||
//draw_sprite_at_ext()
|
87
eastern flames/objects/o_textbox/Step_0.gml
Normal file
87
eastern flames/objects/o_textbox/Step_0.gml
Normal file
|
@ -0,0 +1,87 @@
|
|||
c_input();
|
||||
count++;
|
||||
|
||||
if !txtprocessed {
|
||||
margin = width/20;
|
||||
//if !global.gameplay {
|
||||
//c_savevn(msgscript, style);
|
||||
//}
|
||||
msgscript();
|
||||
talksize = array_length(msg);
|
||||
talkpos = 0;
|
||||
//if msg[talkpos].bg != "UNCHANGED" bg = msg[talkpos].bg;
|
||||
textline_next();
|
||||
/*var dudes = font_get_size(draw_get_font())-1;
|
||||
var dudes2 = floor((sprite_width-margin*2)/dudes);
|
||||
msg[talkpos].text = lb_auto(msg[talkpos].text, dudes2);
|
||||
talklength = string_length(msg[talkpos].text)+1;
|
||||
drawing = ""
|
||||
drawchars = 0;
|
||||
msg[talkpos].event();
|
||||
c_charpush(new talkchar(msg[talkpos].sprite, msg[talkpos].name, msg[talkpos].spritepos));
|
||||
talkspeed = talker[0].textspeed;
|
||||
var i;
|
||||
for (i=0; i<array_length(talker[0].texteffects); i++) {
|
||||
msg[talkpos].text = talker[0].texteffects + msg[talkpos.text];
|
||||
}
|
||||
if msg[talkpos].bg != "UNCHANGED" bg = msg[talkpos].bg;
|
||||
didsounds = array_create(999);
|
||||
didfuncs = array_create(999);
|
||||
atsound = 0;
|
||||
atfunc = 0;*/
|
||||
txtprocessed = true;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i=0; i<array_length(talker); i++) {
|
||||
talker[i].x = lerp(talker[i].x, x+(talker[i].position-2)*width/5, .1);
|
||||
if talker[i].position <= SPRITEPOS.RIGHT {
|
||||
talker[i].alpha = max(talker[i].alpha+.1, 0);
|
||||
} else {
|
||||
talker[i].alpha = min(talker[i].alpha-.1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if back {
|
||||
halting = !halting;
|
||||
}
|
||||
|
||||
if wait || halting {
|
||||
wait--;
|
||||
exit;
|
||||
}
|
||||
|
||||
if !advance {
|
||||
select = false;
|
||||
}
|
||||
if selecting {
|
||||
select = true;
|
||||
selecting = false;
|
||||
}
|
||||
|
||||
|
||||
if drawchars <= talklength && !skipped {
|
||||
skip = select;
|
||||
drawchars += talkspeed;
|
||||
if ncm(4+round((1/talkspeed)/4)) {
|
||||
var guy = audio_play_sound(talker[0].talksound, 0, false);
|
||||
audio_sound_gain(guy, .2, 0);
|
||||
audio_sound_pitch(guy, random(1)+.5);
|
||||
}
|
||||
if skip { //yeah almost
|
||||
while drawchars <= talklength && string_copy(msg[talkpos].text, drawchars+specialchars, 2) != "|w" {
|
||||
//log(string_copy(msg[talkpos].text, drawchars, 2))
|
||||
drawchars++;
|
||||
}
|
||||
}
|
||||
message_draw = string_copy(msg[talkpos].text, 0, drawchars);
|
||||
} else {
|
||||
if select {
|
||||
if (talkpos < talksize-1) {
|
||||
textline_next();
|
||||
} else {
|
||||
endevent();
|
||||
instance_destroy();
|
||||
}
|
||||
}
|
||||
}
|
35
eastern flames/objects/o_textbox/o_textbox.yy
Normal file
35
eastern flames/objects/o_textbox/o_textbox.yy
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"spriteId": null,
|
||||
"solid": false,
|
||||
"visible": true,
|
||||
"spriteMaskId": null,
|
||||
"persistent": false,
|
||||
"parentObjectId": null,
|
||||
"physicsObject": false,
|
||||
"physicsSensor": false,
|
||||
"physicsShape": 1,
|
||||
"physicsGroup": 1,
|
||||
"physicsDensity": 0.5,
|
||||
"physicsRestitution": 0.1,
|
||||
"physicsLinearDamping": 0.1,
|
||||
"physicsAngularDamping": 0.1,
|
||||
"physicsFriction": 0.2,
|
||||
"physicsStartAwake": true,
|
||||
"physicsKinematic": false,
|
||||
"physicsShapePoints": [],
|
||||
"eventList": [
|
||||
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
{"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
{"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
],
|
||||
"properties": [],
|
||||
"overriddenProperties": [],
|
||||
"parent": {
|
||||
"name": "Textbox",
|
||||
"path": "folders/Textbox.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "o_textbox",
|
||||
"tags": [],
|
||||
"resourceType": "GMObject",
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue