PDA

View Full Version : [AS2] iso tactis game, WIP


Kron_Job
08-24-2004, 07:26 PM
Hello. this thread is for my new game called Pyrial Tactics. I have every intention of making this a lrage, single player tactics game that will save your character to the server so you can play from anyplace. well I just started, so I have a map and a couple default characters places, but that's all. please see:

http://stevenstark.irev.net/flash/pyrial_tactics.html

ok, right now you have to view it in IE, and you have to refresh the first time (to pre-load the XML)... now my problem as of now is not the XML loading, I've fixed this already, but how the map actually loads... all the images are the same file, but it slllloooowwwly loads the images one by one... now refresh and it loads up all quick, now that the images are cached. my question is this, is there a way to make this speed up the first time around?

the textures are .jpg files that are loaded via loadMovie, the characters are .swf files loaded in the same manner.

also, I am looking for a good AS-2.0 object oriented for RPG games tutorial, the best one I've found is just for basic oop 2.0 from ultrashock.

also, I am needing to write a map generater program that will export to simple XML files, should I just write this in an old version of flash that supports the FS command saveto?

also note I am making this in an old ass Pentium 2.

well comments and help is always appreciated, you will love this game when finished, I promise you.

deadbeat
08-24-2004, 07:30 PM
Plenty of good tutorials on game dev and related topics - collision, isometry,movement,OOP, etc:

http://www.kirupa.com/developer/actionscript/index.htm

K.

Kron_Job
08-24-2004, 07:33 PM
ooh, yea I see. thanks, that should help alot for the game programming. :)

Kron_Job
08-24-2004, 07:51 PM
I still dont see why it takes soooo long to load the textures the first time around, yet it loads instantly when you refresh... any ideas how to pre-cache the imported loadMovie() files?

Kron_Job
09-06-2004, 07:27 PM
Hello, itt's me again with pyrial tactics. I am working on the movment, but it is troubling me some. it works great at first, but then... epp, it breaks down. moves to the wrong block, and if you play around enuf then link and b.mage will just keep swapping positions X(

http://stevenstark.com/flash/pyrial_tactics.html

the functions to do with movment:


_root.select_square = function(target){
//reset all highlights
for(x=0;x<_root.map.my_texture.length;x++){
for(y=0;y<_root.map.my_texture[x].length;y++){
_root.map["box"+x+"x"+y].top.square.gotoAndStop(1);
delete _root.map["sprite"+x+"x"+y].onPress;
delete _root.map["sprite"+x+"x"+y].onRelease;
delete _root.map["sprite"+x+"x"+y].onRollOver;
delete _root.map["sprite"+x+"x"+y].onRollOut;
delete _root.map["box"+x+"x"+y].onPress;
delete _root.map["box"+x+"x"+y].onRelease;
delete _root.map["box"+x+"x"+y].onRollOver;
delete _root.map["box"+x+"x"+y].onRollOut;
};
};
temp_1 = target.split("box");
temp_2 = temp_1[1].split("x");
new_a = temp_2[0];
new_b = temp_2[1];
temp_1 = _root.targetSprite.split("sprite");
temp_2 = temp_1[1].split("x");
old_a = temp_2[0];
old_b = temp_2[1];
delete temp_1;
delete temp_2;
var temp = [_root.map["sprite"+old_a+"x"+old_b]];
_root.map["sprite"+new_a+"x"+new_b].swapDepths(temp);
delete temp;
_root.map.my_sprite[new_a][new_b] = _root.map["sprite"+old_a+"x"+old_b].character.id_num;
_root.map.my_sprite[old_a][old_b] = 0;
var t_x1 = _root.map["sprite"+new_a+"x"+new_b]._x;
var t_y1 = _root.map["sprite"+new_a+"x"+new_b]._y;
var t_x2 = _root.map["sprite"+old_a+"x"+old_b]._x;
var t_y2 = _root.map["sprite"+old_a+"x"+old_b]._y;
_root.map["sprite"+new_a+"x"+new_b]._x = t_x2;
_root.map["sprite"+new_a+"x"+new_b]._y = t_y2;
_root.map["sprite"+old_a+"x"+old_b]._x = t_x1;
_root.map["sprite"+old_a+"x"+old_b]._y = t_y1;
delete t_x1;
delete t_y1;
delete t_x2;
delete t_y2;
var t_name1 = ["sprite"+old_a+"x"+old_b];
var t_name2 = ["sprite"+new_a+"x"+new_b];
_root.map["sprite"+new_a+"x"+new_b]._name = t_name1;
_root.map["sprite"+old_a+"x"+old_b]._name = t_name2;
delete t_name1;
delete t_name2;
_root.mouse_status = "MOVED";
_root.engine.gotoAndPlay(2);
}




_root.map_radius = function(){
temp_1 = _root.targetSprite.split("sprite");
temp_2 = temp_1[1].split("x");
temp_a = temp_2[0];
temp_b = temp_2[1];
delete temp_1;
delete temp_2;
//reset all highlights
if(_root.map["sprite"+temp_a+"x"+temp_b].character.side == "ally"){
for(x=0;x<_root.map.my_texture.length;x++){
for(y=0;y<_root.map.my_texture[x].length;y++){
_root.map["box"+x+"x"+y].top.square.gotoAndStop(1);
if((_root.map["sprite"+x+"x"+y]._name) !== ("sprite"+temp_a+"x"+temp_b)){
delete _root.map["sprite"+x+"x"+y].onPress;
delete _root.map["sprite"+x+"x"+y].onRelease;
delete _root.map["sprite"+x+"x"+y].onRollOver;
delete _root.map["sprite"+x+"x"+y].onRollOut;
delete _root.map["box"+x+"x"+y].onPress;
delete _root.map["box"+x+"x"+y].onRelease;
delete _root.map["box"+x+"x"+y].onRollOver;
delete _root.map["box"+x+"x"+y].onRollOut;
};
};
};
temp=0;
if(_root.radius_type == "move"){
_root.mouse_status = "MOVE TO?";
radius = _root.map["sprite"+temp_a+"x"+temp_b].character.move_radius;
for(x=0;x<radius;x++){
if(_root.map.my_sprite[temp_a][(temp_b*1)+x] == "0"){
_root.map["box"+temp_a+"x"+((temp_b*1)+x)].top.square.gotoAndStop(2);
_root.map["box"+temp_a+"x"+((temp_b*1)+x)].top.square.onPress = function(){
_root.select_square(this._parent._parent._name);
}
};
if(_root.map.my_sprite[(temp_a*1)+x][temp_b]=="0"){
_root.map["box"+((temp_a*1)+x)+"x"+[temp_b]].top.square.gotoAndStop(2);
_root.map["box"+((temp_a*1)+x)+"x"+[temp_b]].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
if(_root.map.my_sprite[temp_a][(temp_b*1)-x]=="0"){
_root.map["box"+[temp_a]+"x"+((temp_b*1)-x)].top.square.gotoAndStop(2);
_root.map["box"+[temp_a]+"x"+((temp_b*1)-x)].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
if(_root.map.my_sprite[(temp_a*1)-x][temp_b]=="0"){
_root.map["box"+((temp_a*1)-x)+"x"+temp_b].top.square.gotoAndStop(2);
_root.map["box"+((temp_a*1)-x)+"x"+temp_b].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
for(y=0;y<temp;y++){

if(_root.map.my_sprite[(temp_a*1)+y][(temp_b*1)+y]=="0"){
_root.map["box"+((temp_a*1)+y)+"x"+((temp_b*1)+y)].top.square.gotoAndStop(2);
_root.map["box"+((temp_a*1)+y)+"x"+((temp_b*1)+y)].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
if(_root.map.my_sprite[(temp_a*1)+y][(temp_b*1)-y]=="0"){
_root.map["box"+((temp_a*1)+y)+"x"+((temp_b*1)-y)].top.square.gotoAndStop(2);
_root.map["box"+((temp_a*1)+y)+"x"+((temp_b*1)-y)].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
if(_root.map.my_sprite[(temp_a*1)-y][(temp_b*1)+y]=="0"){
_root.map["box"+((temp_a*1)-y)+"x"+((temp_b*1)-y)].top.square.gotoAndStop(2);
_root.map["box"+((temp_a*1)-y)+"x"+((temp_b*1)-y)].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
if(_root.map.my_sprite[(temp_a*1)-y][(temp_b*1)-y]=="0"){
_root.map[((temp_a*1)-y)+"x"+((temp_b*1)-y)].top.square.gotoAndStop(2);
_root.map[((temp_a*1)-y)+"x"+((temp_b*1)-y)].top.square.onPress = function(){_root.select_square(this._parent._paren t._name);}
};
};
if(temp<_root.map["sprite"+temp_a+"x"+temp_b].character.move_radius){
temp++;
} else {
temp--;
};
};
//change the sprite's function, then reset it to normal after
_root.map["sprite"+temp_a+"x"+temp_b].onPress = function(){
//reset all highlights
for(x=0;x<_root.map.my_texture.length;x++){
for(y=0;y<_root.map.my_texture[x].length;y++){
_root.map["box"+x+"x"+y].top.square.gotoAndStop(1);
delete _root.map["sprite"+x+"x"+y].onPress;
delete _root.map["sprite"+x+"x"+y].onRelease;
delete _root.map["sprite"+x+"x"+y].onRollOver;
delete _root.map["sprite"+x+"x"+y].onRollOut;
delete _root.map["box"+x+"x"+y].onPress;
delete _root.map["box"+x+"x"+y].onRelease;
delete _root.map["box"+x+"x"+y].onRollOver;
delete _root.map["box"+x+"x"+y].onRollOut;
};
};
_root.mouse_status = "CANCELLED";
_root.engine.gotoAndPlay(2);
}
_root.map["sprite"+temp_a+"x"+temp_b].onRollOver = function(){
_root.mouse_status = "CANCEL";
};
_root.map["sprite"+temp_a+"x"+temp_b].onRollOut = function(){
_root.mouse_status = "MOVE TO?";
};
} else if (_root.radius_type == "attack"){
trace(_root.map["sprite"+temp_a+"x"+temp_b].character.attack_radius);
} else if (_root.radius_type == "magic"){
trace(_root.map["sprite"+temp_a+"x"+temp_b].character.magic_radius);
} else if (_root.radius_type == "item"){
trace(_root.map["sprite"+temp_a+"x"+temp_b].character.item_radius);
};
};
}




can someone please shed some light on this problem? It's been bugging me all fricken week, I just can't find the solution. if you need, I will zip up the project.

-steven