Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-11-2007, 05:21 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
moving gui

HTML Code:
function onCreated() {
  this.join("sys_gfxdraw");
}
//#CLIENTSIDE
function onCreated() {
  h = this;
  
  this.mainGui();
  this.updateHP();
  this.updateMP();
}
function mainGui() {
  this.gData = {c.wid("arca_hud-base.png"), c.hei("arca_hud-base.png")};
    // ^ public function [getimgwidth, getimgheight]
  if (client.hud_pos == null) {
    client.hud_pos = {c.center(this.gData[0])[0], screenheight};
    // ^ public function [gets position of the screen center]
  }  
  this.mainImg();
}

function mainImg() {
  this.dImg({200, "arca_hud-base.png", {client.hud_pos[0], (client.hud_pos[1] - 25)}, 4});
}

function onMouseDown(click) {
  if (temp.click != "left") {
    return false;
  }
  if (c.mx(client.hud_pos[0], client.hud_pos[0] + this.gData[0]) && c.my(client.hud_pos[1] - this.gData[1], client.hud_pos[1] + 25)) {
    //public function ^ [mousescreenx, mousescreeny]
    scheduleevent(0.05, "Move", "");
  }
}

function onMove() {
  if (mousebuttons > 0) {
    client.hud_pos = {(mousescreenx - (this.gData[0] / 2)), mousescreeny};

    this.mainImg();
    this.updateHP();
    this.updateMP();
    
    scheduleevent(0.05, "Move", "");
  }
}

public function updateHP() {
  this.dImg({201, "arca_hud-greenbar.png", {(client.hud_pos[0] + 1), (client.hud_pos[1] - 7)}, 5});
}

public function updateMP() {
  this.dImg({202, "arca_hud-bluebar.png", {(client.hud_pos[0] + 116), (client.hud_pos[1] - 7)}, 5});
}
Here's the class [sys_gfxdraw]
HTML Code:
//#CLIENTSIDE
function dImg(img) {
  showimg(temp.img[0], temp.img[1], temp.img[2][0], temp.img[2][1]);
  changeimgvis(temp.img[0], temp.img[3]);
  changeimgmode(temp.img[0], 1);
}
Here's what it looks like on graal [You can move it around!]
Attached Thumbnails
Click image for larger version

Name:	gGui.png
Views:	392
Size:	8.6 KB
ID:	43046  
__________________
Reply With Quote
 


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 05:19 PM.


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