Both line in a single code. Hehe,I think round() does it.
Ahh,its pretty embarasing...almost 3 years messing with GE yet know about round just now,
if(p1speed<p2speed)//CreateTimer(p2 move attack)
if(p1speed>p2speed)//CreateTimer(p1 move attack)
if(p1speed==p2speed)//decide who will attack first randomly
first = (p1.speed > p2.speed);
if (first > 1) { set p1 timer}
set p2 timer
first = 1;
set p2 timer
if(first>0){set p1 timer; destroy p2 timer;}
first=1;
Bee-Ant wrote:Hmm...just as I thought...
But have corrected
- Code: Select all
set p2 timer
if(first>0){set p1 timer; destroy p2 timer;}
first=1;
Thanks
char str[15];
first=(p2speed>p1speed)+1;
sprintf(str,"p%iattack",first);
CreateTimer(str);
Fuzzy wrote:Excellent work! That is very concise code.
Fuzzy wrote:How would you do it if you had 3 or more attackers?
Do you think you could do a whole game with no IF? Not WB, but some other game in the future?
int speed[4];
for(i=0;i<4;i++)
{
sprintf(str,"p%order",i+1);
CreateTimer(str,1000/spd[i] ms);
}
order[current_order]=1;
current_order++;
order[current_order]=2;
current_order++;
order[current_order]=3;
current_order++;
order[current_order]=4;
current_order++;
sprintf(str,"p%iattack",order[current_attacker]);
CreateTimer(str);
current_attacker++;
DST wrote:rather than sending a timer to 4 different locations (if i read your script correctly)
Users browsing this forum: No registered users and 1 guest