Jump to content

Recommended Posts

right my code now is:

 

$stars = imagecreatefrompng("./img/nrpg/base_m.png");



  $gradient = imagecreatefrompng("./img/nrpg/swords/sword2.png");
  

// Copy
imagecopy($stars,  $gradient, -2, 21, 0, 0, 39, 39);

// Output and free from memory
header('Content-Type: image/png');
imagesavealpha($gradient,true);
imagesavealpha($stars,true);
imagepng($stars);
  
  

  imagedestroy($stars);
  imagedestroy($gradient);

 

 

And it shows:

 

MY male character with his sword in the correct position.

 

But what If I want to add a hat/boots/gloves?  How would I go about that?

 

Pretty much I need a way to add more imagecopy items over the item

Multiple calls to imagecopy?

 

WOW

did not know you could that

// Create image instances
$character = imagecreatefrompng("./img/nrpg/base_m.png");
$sword = imagecreatefrompng("./img/nrpg/swords/sword2.png");
$boots = imagecreatefrompng("./img/nrpg/boots/boots1.png");
  

// Copy
imagecopy($character,  $sword, -2, 21, 0, 0, 39, 39);
imagecopy($character,  $boots, 29, 75, 0, 0, 38, 35);

// Output and free from memory
header('Content-Type: image/png');
imagesavealpha($character,true);
imagesavealpha($sword,true);
imagesavealpha($boots,true);
imagepng($character);

 

This is what I call server side securitY! Haha, now just check if the user has those items bought, and make the image server side.  This is epic.

 

OMG awesome, Thanks xyph!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.