Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Gani Generator (360 degrees) (https://forums.graalonline.com/forums/showthread.php?t=134261820)

xAndrewx 01-23-2011 07:40 PM

Gani Generator (360 degrees)
 
Here's an example on how to make ganis via script, it's alot easier than you think (if you're interested in learning it)

This script generates the Era iPhone car ganis (Including other passengers)
PHP Code:

function onCreated() {
  
generateCarGani();
}

function 
generateCarGani() {
  
temp.framecount 64;

  echo(
"GANI0001");
  echo(
"SPRITE  100                HEAD  0    0   32   32 head up");
  echo(
"SPRITE  101                HEAD  0   32   32   32 head left");
  echo(
"SPRITE  102                HEAD  0   64   32   32 head down");
  echo(
"SPRITE  103                HEAD  0   96   32   32 head right");

  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    echo(
format("SPRITE  %3d               ATTR2  0    0   64  106 car"500+temp.i));
  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    echo(
format("SPRITE  %3d era_spotlight_1.png  0    0   64  128 spot light"600+temp.i));

  for (
temp.i=0temp.i<=temp.framecounttemp.i++) {
    
temp.angle = (pi/2*pi temp.i/temp.framecount) % (2*pi);
    echo(
format("ROTATEEFFECT %3d %f"500+temp.itemp.angle));
    echo(
format("ROTATEEFFECT %3d %f"600+temp.itemp.angle));
    echo(
format("EFFECTMODE %3d 0"600+temp.i));
    echo(
format("COLOREFFECT %3d 1 1 0.8 0.6"600+temp.i));
  }

  echo(
"CONTINUOUS");
  echo(
"SINGLEDIRECTION");
  echo(
"DEFAULTATTR1 era_car0_0.png");
  echo(
"DEFAULTHEAD head19.png");
  echo(
"DEFAULTBODY body.png");

  echo(
"ANI");
  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    
generateGaniFrame(temp.itemp.framecount);
  echo(
"ANIEND");
}

function 
generateGaniFrame(curframemaxframe) {
//   car  -8 -21, light  -32 -128, light   13 -128, playerhead 9 20
// Head: 100-103
// Car: 500+
// Light: 600+

  
temp.angle 2*pi curframe/maxframe;
  
temp.str "";
  
  
// Car sprite
  
temp.str @= format("%4d %4d %4d"500+curframe, -8, -21);
  
  
// Left light
  
temp.lightsvec = {-1.455.95};
  
temp.1.5 2;
  
temp.2   4;
  
temp.+= cos(temp.angle)*temp.lightsvec[1] + sin(temp.angle)*temp.lightsvec[0];
  
temp.+= cos(temp.angle)*temp.lightsvec[0] - sin(temp.angle)*temp.lightsvec[1];
  
temp.str @= format(", %4d %4d %4d"600+curframeint(temp.x*16), int(temp.y*16));

  
// Right light
  
temp.lightsvec = {1.355.95};
  
temp.1.5 2;
  
temp.2   4;
  
temp.+= cos(temp.angle)*temp.lightsvec[1] + sin(temp.angle)*temp.lightsvec[0];
  
temp.+= cos(temp.angle)*temp.lightsvec[0] - sin(temp.angle)*temp.lightsvec[1];
  
temp.str @= format(", %4d %4d %4d"600+curframeint(temp.x*16), int(temp.y*16));
  
  
// Player head and npc head
  
temp.dir getdir(cos(temp.angle), -sin(temp.angle));
  
temp.playerstr format(", %4d %4d %4d"100+temp.dir88);
  
temp.headx 0;
  
temp.heady = -2;
  
temp.temp.heady*cos(temp.angle) + temp.headx*sin(temp.angle);
  
temp.temp.headx*cos(temp.angle) - temp.heady*sin(temp.angle);
  
temp.npcstr format(", %4d %4d %4d"104+temp.dir8+int(temp.x*16), 8+int(temp.y*16));
  if (
temp.>= 0) {
    
temp.str @= temp.playerstr;
    
temp.str @= temp.npcstr;
  } else {
    
temp.str @= temp.npcstr;
    
temp.str @= temp.playerstr;
  }

  echo(
temp.str);  



PowerProNL 01-23-2011 07:57 PM

Nice ++

Cosss 01-23-2011 08:27 PM

real fancy stuff there, I'll rep you for sharing this with us

fowlplay4 01-23-2011 08:36 PM

Looks like an NC Spammer, but reminded me to add strechx, stretchy, and mode effects into my gani class.

Deas_Voice 01-23-2011 08:51 PM

Quote:

Originally Posted by fowlplay4 (Post 1625193)
Looks like an NC Spammer

that's what i thought too.
why not put it into a file or something'

xAndrewx 01-23-2011 10:04 PM

I'm sure you guys can do that if you wanted lol


All times are GMT +2. The time now is 02:18 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.