Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-29-2007, 06:45 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Graphical Interface

Here's a simple gui effect

HTML Code:
//#CLIENTSIDE
function onCreated()
{
  playergui = this;
  this.startGui();
}

function startGui()
{
  this.guiPosition = {2, 2};
   
  this.updateData();
  
  for (temp.currentImage: this.imageData)
  {
    this.drawImage(temp.currentImage);
  }
}
function updateData()
{
  this.imageData = {
    {200, "c_gui-base.png", this.guiPosition, 4},
    {201, player.headimg, {(this.guiPosition[0] + 4), (this.guiPosition[1] + 6)}, 5, {0, 64, 32, 32}},
    {202, "c_gui-hpbar.png", {(this.guiPosition[0] + 42), (this.guiPosition[1] + 11)}, 5, {0, 0, this.findBar("hp"), 7}},
    {203, "c_gui-mpbar.png", {(this.guiPosition[0] + 42), (this.guiPosition[1] + 22)}, 5, {0, 0, 59, 7}}
  };
}
function drawImage(imageData)
{
  showimg(temp.imageData[0], temp.imageData[1], temp.imageData[2][0], temp.imageData[2][1]);
  changeimgvis(temp.imageData[0], temp.imageData[3]);
  if (temp.imageData[4].size() == 4)
  {
    changeimgpart(temp.imageData[0], temp.imageData[4][0], temp.imageData[4][1], temp.imageData[4][2],temp.imageData[4][3]);
  }
}

function findBar(barType)
{
  if (temp.barType == "hp")
    return ((player.hearts / player.fullhearts) * 59 <= 1? 1: (player.hearts / player.fullhearts) * 59);
}

public function updateHP()
{
  this.updateData();
  this.drawImage(this.imageData[2]);
}

public function updateMP()
{ 
  //place holder, make your own! 
}
public function hideGui()
{
  hideimgs(200, 210);
}
Here are the images! It's the top left gui thing.
Attached Thumbnails
Click image for larger version

Name:	myGui.png
Views:	365
Size:	24.6 KB
ID:	41353  
Attached Images
   
__________________
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:35 PM.


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