Split screen help

Non-platform specific questions.

Split screen help

Postby tzoli » Sat Jun 04, 2011 10:31 am

Hi
I'm trying to make a game with split screen but if i shoot bullets they doesn't appears on the splited screen.
Please help!I use draw_from to make in split screen.
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Split screen help

Postby schnellboot » Sat Jun 04, 2011 11:00 am

try to be more precise pls
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Split screen help

Postby jimmynewguy » Sat Jun 04, 2011 11:29 am

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
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Split screen help

Postby tzoli » Sat Jun 04, 2011 12:56 pm

Thanks :D
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Split screen help

Postby RippeR7420 » Sat Sep 20, 2014 3:13 pm

Could someone go into detail about what this Global Code does? I sure would appreciate it :)
It sort of makes sense to me, But when I try to use it, it says "Error line 2: Illegal redefinition of builtin function getclone2".

Thanks in advance!
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Split screen help

Postby lcl » Sat Sep 20, 2014 4:13 pm

The Global Code part in that code is just a function to get access to single clones by their actor name and cloneindex. The reason why you get that error is that the 1.4.1 version of GE already has a built in getclone2-function, so you can't define a new function with the same name.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Split screen help

Postby skydereign » Sat Sep 20, 2014 11:01 pm

And just so you know, that version of the getclone2 function in unnecessarily complex. It is using a bunch of str functions, first to set the resulting string, then concats a period, then uses sprintf to set another string with the cloneindex value, and then cat that onto the resultString. You could do all of that with one sprintf call. Here is the shorter version.
Code: Select all
Actor*
getclone2(char* actor_name, int c_index)
{
    char buffer[30];
    sprintf(buffer, "%s.%d", actor_name, c_index);
    return (getclone(buffer));
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Split screen help

Postby speckford123 » Wed Dec 10, 2014 7:56 pm

Oh gosh, I forgot I made a splitscreen demo a while back
the memories, haha
speckford123
 
Posts: 334
Joined: Fri May 05, 2006 6:33 pm
Score: 49 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron