Page 1 of 1

War&Combat

PostPosted: Wed Feb 01, 2006 8:26 am
by DilloDude
This topic is about a game I am planning on making. It is a simple turn-based-strategy. I have a few questions and problems, but I'll get to those shortly. First of all, the intro game. This is a simple intro, with a menu. About the animations: My main problem is I have an animation to play, which consists of multiple files. I would like to simplify it, making it a single file. The simple way would be to copy and paste it, but that would be long and tedious, considering there are 100 frames! :shock: , although the first lot (about 45 or something) are exactly the same. I could only use one of these, and use a timer, but that still leaves about 55 frames. Does anyone know a simple way of collecting multiple files in one picture? Not that I can't use multiple files, but it makes a big data folder, and it would be better to just use one image. Any help relating to this, or any other question further on in this topic would be much appreciated.

PostPosted: Wed Feb 01, 2006 11:15 am
by Novice
Graphics gale can batch imort images and then you can easly manipulate them, it also has a function that allows you to save your animations as a single image. Hope it helps

PostPosted: Wed Feb 01, 2006 10:33 pm
by DilloDude
Thanks for that! It was really helpful (Still is a big file, though, and takes a long time to export, but now I don't need to have 100 loose bitmaps lying around)! :P

PostPosted: Wed Feb 01, 2006 11:32 pm
by Novice
NP. 8)
If you have Photoshop it has a very usefull function called save for web, it makes images so much smaller in size it's incredible. I saved a 640*480 image that was 1.2 mb to 90 kb and lost none of the quality. I dont know wich other programs have this funtion but you should ask around.

PostPosted: Wed Feb 01, 2006 11:58 pm
by DilloDude
Novice wrote:NP. 8)
If you have Photoshop it has a very usefull function called save for web, it makes images so much smaller in size it's incredible. I saved a 640*480 image that was 1.2 mb to 90 kb and lost none of the quality. I dont know wich other programs have this funtion but you should ask around.

Cool!
Well now on to business. Firt, I will describe the setting. I have made a board for the game. It is like a chackerboard pattern with different colours for different types of terrain. I have a 'Marker' or cursor which is moved by the arrow keys. I have a turnmarker in a corner, for showing whose turn it is. I have a building that is created at start, called RedHQ. I have another building to be built by the red HQ, called a RedTH (for town hall or something.) I want to move the marker over the HQ, press a button, and be able to select a location five squares away that is not in water, and be able to build the TH there. (If I try to build on water, I may want to play a music file.) If you have any questions about the setup, please reply, and I will try to explain. As before, help would be much appreciated.

PostPosted: Thu Feb 02, 2006 12:26 am
by Novice
Use a varibale and the distance betwen the building in an if statement.
On mouse button down on something create an actor with the redTH anim that follows the mouse.
On draw that actor.
Code: Select all
if (distance(redHQ,redTH)>100||coliding with ("Water")) CanBuild=0;

On mouse button down on ground
Code: Select all
if (CanBuild==1)CreateActor ("redTH");
else PlaySound ("Bleep");

This is all pseudo code, sorry but i havent got the time now, this is just a scafold you can do lots of thing with it like
Code: Select all
if (CanBuild==0)
{redTH.r=255;
redTH.g=100;
redTH.b=100;}

Wich would make the building apear red while you are unable to build.
Use your imagination.
Hope it helped.

PostPosted: Thu Feb 02, 2006 3:15 am
by DilloDude
Okay, I've got it working mostly. currently I'm trying to find a way to move the TH to the center of the square closest to the marker. I'm using
Code: Select all
xscreen = (round(xscreen/50)*50)-25;
yscreen=(round(yscreen/50)*50)-25;
in create actor. I can use +25 or -25, but I want it to find which is closer to it's current location and use that.IE. if (round(xscreen/50)*50)-25 is closer to xscreen than (round(xscreen/50)*50)+25, use it, otherwise, use the one with +25.

PostPosted: Thu Feb 02, 2006 5:24 pm
by Novice
I dont quite understand your problem but i imagine that the solution would be creating a variable that would be -25/+25 and then using an if to check wich is closer,
Code: Select all
int i,e;
i=(round(xscreen/50)*50)-25;
e=(round(xscreen/50)*50)+25;
if ((xscreen+i)>(xscreen+e)) [variable]=+25;
else [variable]=-25;

or something like this(not sure how much is good, dont have to much time now)and then use
Code: Select all
xscreen = (round(xscreen/50)*50)+[variable];

Does this help :?:

PostPosted: Fri Feb 03, 2006 1:36 am
by DilloDude
Novice wrote:I dont quite understand your problem but i imagine that the solution would be creating a variable that would be -25/+25 and then using an if to check wich is closer,
Code: Select all
int i,e;
i=(round(xscreen/50)*50)-25;
e=(round(xscreen/50)*50)+25;
if ((xscreen+i)>(xscreen+e)) [variable]=+25;
else [variable]=-25;

or something like this(not sure how much is good, dont have to much time now)and then use
Code: Select all
xscreen = (round(xscreen/50)*50)+[variable];

Does this help :?:

Hmmm. Might try something like that.