I assume you're using speckford's splitscreen demo, in that case:
bullet -> create actor -> script editor
- Code: Select all
bulletcount ++;
Makes it so we know how many bullets there are
bullet -> destroy actor -> script editor
- Code: Select all
bulletcount --;
Still just lets us know how many bullets
viewP1 -> draw actor -> script editor
- Code: Select all
int i;//needed for loop
erase(0, 0, 0, 1);
for(i=0; i < bulletcount; i++)//loop through all the bullets
{
Actor * this = getclone2("bullet", i);//so we can use pointers for x & y, can't do bullet.i.x
draw_from("bullet.i", 320+this->x-p1.x, 160+this->y-p1.y, 1);//draw that bullet
}
viewP2 -> draw actor -> script editor
- Code: Select all
int i;
erase(0, 0, 0, 1);
for(i=0; i < bulletcount; i++)
{
Actor * this = getclone2("bullet", i);
draw_from("bullet.i", 320+this->x-p2.x, 160+this->y-p2.y, 1);
}
almost same thing as last code, but for viewP2
Global Code
- Code: Select all
Actor * getclone2 ( char * actorName, long cloneNumber )
{
char resultString[256] = "";
char cloneNumberAsString[10];
Actor * resultActor;
strcpy ( resultString, actorName );
strncat ( resultString, ".", 1 );
sprintf (cloneNumberAsString, "%i", cloneNumber);
strncat ( resultString, cloneNumberAsString, 10 );
resultActor = getclone(resultString);
return resultActor;
}
Jazz_e_bob's awesome code so we can get the clone of the bullet in order to draw him