xAndrewx

05-29-2007, 06:45 PM

Here's a simple gui effect

//#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.

//#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.