KART WITH AI

Software: Away3D 4.x

Avatar
Luca, Sr. Member
Posted: 15 February 2013 04:39 PM   Total Posts: 230

At this time we have:

http://estiva2.altervista.org/SiteGames/Kart/Kart.php

so, please give me more POWER !!!!

smile smile smile

THANKS !

   

Avatar
Luca, Sr. Member
Posted: 16 February 2013 07:01 AM   Total Posts: 230   [ # 1 ]

This is the very very simple HUD code, and must be corrected but works !
smile

  [Embed(source=“resources/Contagiri1.png”)]private var ContagiriImg:Class;
  [Embed(source=“resources/Contachilometri.jpg”)]private var ContachilometriImg:Class;

// BITMAP CONTAGIRI
private var PowerBitmap:Bitmap; 
// DATI BITMAP BARRA ENERGIA ATTORE
private var bdataPower:BitmapData;
// RIEMPIMENTO BARRA ENERGIA ATTORE
private var ActorPower:Shape = new Shape();

  //——————————————————————————————————————————————————————-
  // RESTART GAME
  //——————————————————————————————————————————————————————-
  private function CreaContagiri():void
  {
 
  //
  bdataPower = new BitmapData( 200, 200, true, 0x000000 );

  bdataPower.copyPixels( new ContagiriImg().bitmapData,
  new Rectangle( 0, 0, 200, 200 ),
  new Point(), null, null, false );

  ActorPower.graphics.lineStyle( 4, 0xFF0000, 1 );
  ActorPower.graphics.beginFill( 0x00ff00 );
  ActorPower.graphics.moveTo( 100, 100 );
  ActorPower.graphics.lineTo( 100 + ( 60 * Math.sin( 240 * DEGREES_TO_RADIANS ) ), 100 - ( 60 * Math.cos( 240 * DEGREES_TO_RADIANS ) ) );
  ActorPower.graphics.endFill();

  //
  bdataPower.draw( ActorPower ); 
  //
  PowerBitmap = new Bitmap( bdataPower );
  //
  PowerBitmap.name = “Contagiri”;
  //
  PowerBitmap.alpha = 0.4;
  //
  stage.addChild( PowerBitmap );
  //
  //PowerBitmap.y = 162.0;
  }
 
 
  //——————————————————————————————————————————————————————-
  // CALCOLA E VISUALIZZA POSIZIONE GIOCATORE NELLA MAPPA
  //——————————————————————————————————————————————————————-
  public function AggiornaContagiri():void
  {
  var GP:Number = 240.0;

  GP += ( 200.0 / ( CCarAI1.LimGiri0 - CCarAI1.LimGiri1 ) ) *  CCarAI1.Giri;
 
  //
  var bd:BitmapData = new BitmapData( 200, 200, true, 0x000000 );
  bdataPower.copyPixels( new ContagiriImg().bitmapData,
  new Rectangle( 0, 0, 200, 200 ),
  new Point(), null, null, false );
 
  //
  ActorPower.graphics.clear();
  ActorPower.graphics.lineStyle( 4, 0xFF0000, 1 );
  ActorPower.graphics.beginFill( 0x00ff00 );
  ActorPower.graphics.moveTo( 100, 100 );
  ActorPower.graphics.lineTo( 100 + ( 60 * Math.sin( GP * DEGREES_TO_RADIANS ) ), 100 - ( 60 * Math.cos( GP * DEGREES_TO_RADIANS ) ) );
  ActorPower.graphics.endFill();

  //
  bdataPower.draw( ActorPower );
  //
  PowerBitmap = new Bitmap( bdataPower );
  //
  // PowerBitmap.y = 162.0;
  }

   

Mona, Newbie
Posted: 23 February 2013 02:12 AM   Total Posts: 6   [ # 2 ]
Luca - 16 February 2013 07:01 AM

This is the very very simple HUD code, and must be corrected but works !
smile

  [Embed(source=“resources/Contagiri1.png”)]private var ContagiriImg:Class;
  [Embed(source=“resources/Contachilometri.jpg”)]private var ContachilometriImg:Class;

// BITMAP CONTAGIRI
private var PowerBitmap:Bitmap; 
// DATI BITMAP BARRA ENERGIA ATTORE
private var bdataPower:BitmapData;
// RIEMPIMENTO BARRA ENERGIA ATTORE
private var ActorPower:Shape = new Shape();

  //——————————————————————————————————————————————————————-
  // RESTART GAME
  //——————————————————————————————————————————————————————-
  private function CreaContagiri():void
  {
 
  //
  bdataPower = new BitmapData( 200, 200, true, 0x000000 );

  bdataPower.copyPixels( new ContagiriImg().bitmapData,
  new Rectangle( 0, 0, 200, 200 ),
  new Point(), null, null, false );

  ActorPower.graphics.lineStyle( 4, 0xFF0000, 1 );
  ActorPower.graphics.beginFill( 0x00ff00 );
  ActorPower.graphics.moveTo( 100, 100 );
  ActorPower.graphics.lineTo( 100 + ( 60 * Math.sin( 240 * DEGREES_TO_RADIANS ) ), 100 - ( 60 * Math.cos( 240 * DEGREES_TO_RADIANS ) ) );
  ActorPower.graphics.endFill();

  //
  bdataPower.draw( ActorPower ); 
  //
  PowerBitmap = new Bitmap( bdataPower );
  //
  PowerBitmap.name = “Contagiri”;
  //
  PowerBitmap.alpha = 0.4;
  //
  stage.addChild( PowerBitmap );
  //
  //PowerBitmap.y = 162.0;
  }
 
 
  //——————————————————————————————————————————————————————-
  // CALCOLA E VISUALIZZA POSIZIONE GIOCATORE NELLA MAPPA
  //——————————————————————————————————————————————————————-
  public function AggiornaContagiri():void
  {
  var GP:Number = 240.0;

  GP += ( 200.0 / ( CCarAI1.LimGiri0 - CCarAI1.LimGiri1 ) ) *  CCarAI1.Giri;
 
  //
  var bd:BitmapData = new BitmapData( 200, 200, true, 0x000000 );
  bdataPower.copyPixels( new ContagiriImg().bitmapData,
  new Rectangle( 0, 0, 200, 200 ),
  new Point(), null, null, false );
 
  //
  ActorPower.graphics.clear();
  ActorPower.graphics.lineStyle( 4, 0xFF0000, 1 );
  ActorPower.graphics.beginFill( 0x00ff00 );
  ActorPower.graphics.moveTo( 100, 100 );
  ActorPower.graphics.lineTo( 100 + ( 60 * Math.sin( GP * DEGREES_TO_RADIANS ) ), 100 - ( 60 * Math.cos( GP * DEGREES_TO_RADIANS ) ) );
  ActorPower.graphics.endFill();

  //
  bdataPower.draw( ActorPower );
  //
  PowerBitmap = new Bitmap( bdataPower );
  //
  // PowerBitmap.y = 162.0;
  }

A great experience, I’m looking for ideas for me.
Thanks

 

   

Avatar
Luca, Sr. Member
Posted: 23 February 2013 07:39 AM   Total Posts: 230   [ # 3 ]

smile

   
   
‹‹ Flocking demo?

X

Away3D Forum

Member Login

Username

Password

Remember_me



X