PDA

View Full Version : okay so...



Master Maniac
06-10-2008, 07:45 PM
I have two questions.

1- managing Lweapons. their X and Y coordinates can be manipulated and checked like everything else, right?
like this:

if(LW_SWORD->X>=this->X&&LW_SWORD->X<=this->X+16&&LW_SWORD->Y>=this->Y&&LW_SWORD->Y==this->Y+16){
that would be valid, right?

2- the possibility of arrays. can the following be converted into an array? and if so, can someone do it for me? i haven't the faintest clue as to how to make arrays work.

if(enemy_exist){
if(enemy_max==1){
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==2){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==3){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==4){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==5){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==6){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==7){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==8){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==9){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==10){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
}

thanks for any help =)

Gleeok
06-10-2008, 07:52 PM
if(enemy_exist){
if(enemy_max==1){
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==2){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==3){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==4){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==5){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==6){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==7){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==8){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==9){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
else if(enemy_max==10){
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
Screen->CreateNpc(e);
enemy_exist=false;
}
}

thanks for any help =)

Condensed to single line. :)


int i;
while(i++<enemy_max){ [E!] = Screen->CreateNPC(e); enemy_exist = false;}

Master Maniac
06-10-2008, 07:59 PM
awesome gleeok. simply awesome. thank you.

EDIT:
also, how do i make a "colision effect" when an arrow hits n FFC? I thought about doing LW_ARROW->Data= (whatever) but that wouldn't make the "arrow flash" sprite thingy. and i don't even know if LW->Data even works. this is the first time i've ever used LWeapons in scripting, so i'm a little clueless right now.

Gleeok
06-11-2008, 01:42 AM
lweapon arrow = Screen->CreateLWeapon(LW_ARROW);
if(arrow->isValid())
{
if(Abs(arrow->X-ffc->X)<16 && Abs(arrow->Y-ffc->Y)<16)
{
arrow->DeadState=0;
//do something
}}

Master Maniac
06-11-2008, 06:02 PM
LW_ARROW->DeadState=0;

this will work, right? i'm not creating LWeapons, just manipulating them.

Gleeok
06-11-2008, 06:43 PM
Oh, well DeadState=0; just tells the game to remove the weapon.

You need LoadLWeapon instead. I think you can check if it's an arrow by: if(lweap->ID == [id]){

Haven't tried it yet though.