[Behavior] Inject base64 string as Sprite Image

0 favourites
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • <font color="red">New build : You can now specify the width/height of the container when loading the image. The refresh should also work better. The demo is updated !

    Plugin : http://dl.dropbox.com/u/1412774/InjectImage/pode_injectImage.0.2.zip

    .capx : http://dl.dropbox.com/u/1412774/InjectImage/InjectImage.0.2.capx


    <font color="blue">Edit : added this info : you can also directly inject the URL of an image, instead of a base64 string !</font>

    Since you can extract current Image (http://www.scirra.com/forum/behavior-extract-sprite-to-base64-string_topic50577.html), why not inject Image ? <img src="smileys/smiley1.gif" border="0" align="middle">

    <img src="http://dl.dropbox.com/u/1412774/InjectImage/demo.png" border="0">


    For the moment, you can inject base64 string, and it's going to replace the current Sprite image's texture.

    .capx : http://dl.dropbox.com/u/1412774/InjectImage/InjectImage.capx

    Plugin : http://dl.dropbox.com/u/1412774/InjectImage/pode_injectImage.0.1.zip

    <font color="red">BEWARE !! The collision polygon used is stilll the one from the first Sprite ! So for the moment, if you use collisions, and want that everything goes smooth, keep injecting images of roughly the same shape !</font>

    <font color="blue">If you don't use collisions, you don't care about that anyway <img src="smileys/smiley2.gif" border="0" align="middle"></font>

    I'm going to provide a way to specify a new polygon in a new release...

  • Very cool. Now it's propable possible to save and load images in simple textfiles.. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • There ya go, encapsulation. Ha ha, take that flash!

    Just need a way to do that with sound, which I think is in the works.

    Might see if Ashley could add a way to change the poly from the ide tho...

  • thanks for pointing me to this plugin, it does what i need!!

  • Unable to load plugin in XXX: Found 'GetPluginSettings' global, but it is not a function.

    This plugin will not be available in the editor.

    EDIT: Disregard my ignorance.. I leave this in case somebody has the same problem. This is a Behavior not a plugin, so it goes in the behaviors folder!

  • I would like to say that this is the single most useful plugin for c2.

    The way Pode handled this is pure genius and simply works. If you have a large application, especially for mobile this can turn c2 into a professional tool because it adds resource managment.

    I offered a reward to Pode because it saved my project that I was about to throw away and convert to another framework, he's such a nice guy that he didn't accept anything.

    Seriously guys this tools is a lifesaver, until Ashley write some sort of resource managment if you are developing for mobile this tools is compulsory for large projects and can drastically increase fps in slower phones.


  • Pode could you take a look at this ?


  • Wishy : I answered your post, and added the info to the original post of this thread.

  • Awesome man, thnx for the help !!!

  • Hi Pode,

    When you get a moment, can you give an example capx of how to inject the URL of an image?

  • Pode I have a strange issue.

    On iPad (and mind only on iPad) the plugin doesn't work. I load the image on an event and unless the user touch a part of the screen the image doesn't get injected. Do you have any idea about why this could happen? I think it's for the way I'm resizing the screen is this a possibility?


  • Pode I found the culprit for reasons unknown this never fires:


    until the user touch the screen (and even then is unpredictable) do you know why? Is there any way to forse the loading?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Mulkaccino : it's easy ! For example, in the demo I posted in the original post, you can, in one of the two textboxes, paste the URL of an image, and click on "Inject", and voil� !. <img src="smileys/smiley1.gif" border="0" align="middle" />

    0plus1: it's strange. I didn't heard of any particular quirk or bug from the iOS Webkit build with the onload() event. I'm going to check that tomorrow. If it's a bug, I'm going to try a false 'click' event to resolve that.

  • Pode, don't worry about that because it's probably an issue with the simulator.

    Instead, your plugin on both android/iphone when the aspect ration changes from the original one it fires an error in this line of the engine:

    ctx.drawImage(cur_image, myx, myy, this.width, this.height);

    do you have any idea of why?

  • 0plus1: I suppose that when the ratio aspect changes, it invalidates the width/height values. I'm going to add a check before, to rewrite those values based on the new aspect ratio.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)