Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Looking for tutorial script05_2.c = missing in zip file...fehlt #283789
08/10/09 06:12
08/10/09 06:12
Joined: Aug 2009
Posts: 2
Seattle, WA
L
LarryJ Offline OP
Guest
LarryJ  Offline OP
Guest
L

Joined: Aug 2009
Posts: 2
Seattle, WA
I was unable to find the referenced script05_2.c in the lite-c tutorial...does anybody have that, or can cut and paste the code? Much appreciated.

Larry

Re: Looking for tutorial script05_2.c = missing in zip file...fehlt [Re: LarryJ] #283792
08/10/09 07:23
08/10/09 07:23
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Download the scripts again, or here:
Click to reveal.. (script25.c)
Code:
////////////////////////////////////////////////////////////////////////////
// simple lite-C LAN game 
////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
 
action player_move() // control the player on the client, move it on the server
{    
  var walk_percentage = 0;
  while (1) 
  {
    if (my.client_id == dplay_id) { // the following code runs on the player's client only
      my.skill1 = key_w - key_s; // forward/backward
      my.skill2 = key_a - key_d; // rotation
      send_skill(my.skill1,0);   // send skill1-2 to the server
      send_skill(my.skill2,0);
    }

    if (connection & CONNECT_SERVER) { // the following code runs on the server only
      my.pan += my.skill2*5*time_step;   // rotate the entity using its skill2
      var distance = c_move(me,vector(my.skill1*5*time_step,0,0), NULL, GLIDE); // move it using its skill1
      walk_percentage += 1.5 * distance;
      ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // animate the entity
    }
    wait (1);
  }
}

function main() 
{
  dplay_bandwidth = 0; 
   
  if (!connection) 
    error("Start as server or client!");
  else 
    while (dplay_status < 2) wait(1); // wait until the session is opened or joined

  dplay_localfunction = 2; // run actions both on server and client
  level_load ("multiplayer6.wmb");
  vec_set(camera.x, vector (-600, 0, 100)); // set a proper camera position

  if (connection & CONNECT_SERVER)  // this instance of the game runs on the server
    ent_create ("redguard.mdl", vector (100, 50, 40), player_move); // then create the red guard!
  else // otherwise, it runs on a connected client
    ent_create ("blueguard.mdl", vector (-100,-50, 40),player_move); // create the blue guard
}




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1