I am working on a strategy game,i have a variable named food and another variable named foodproduction,what i want but don't know how to do is:
every 1 minute food=food+foodproduction
food_timer++;
if(food_timer>=30) // one second
{
food_timer = 0; // set it back to 0
food += foodproduction;
}
food += foodproduction.
player_anim = player.animindex;
saveVars("player_vars", "player_vars");
if(vfood==100&&vstone==200)
{
ChangeAnimation("bcave", "cave_entrance.svg_", "NO_CHANGE");
}
skydereign wrote:Current animation of an actor is stored by the animindex variable. If for instance you want to save the player's current animindex, you can create a variable with the gui and put it in a savegroup. That way you can just do this.
- Code: Select all
player_anim = player.animindex;
saveVars("player_vars", "player_vars");
The same can be done to save the text variable of text actors.
atownhall = btownhall.animindex; //atownhall is the variable saved in buildings group,btownhall is the buildings with 2 animations(one empty,one with the buildings)
afarm = bfarm.animindex;
saveVars("citystatus.kng", "buildings");
loadVars("citystatus.kng", "production");
vfood=resources[0];
vfood=resources[1];
vfood=resources[2];
foodproduction=production[0];
woodproduction=production[1];
stoneproduction=production[2];
loadVars("citystatus.kng", "buildings");
btownhall.animindex=buildings[0];
bfarm.animindex=buildings[1];
skydereign wrote: store the variable as the animation name instead. If you store the animation name, you can just use it for the ChangeAnimation function.
Users browsing this forum: No registered users and 1 guest