Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hey All Carrying on from https://www.ambiera.com/forum.php?t=8948 So I have an animated gif, if I extract the frames, this results in 100 frames. Not a problem, but in the 2d overlay, the option in there I see if change a texture. I don't see animate an texture which I guess is because it is reserved for 3d mesh rather than a 2d plain. Has anyone seen any script of running frame000.png to frame100.png on a 2d overlay? I've searched the forum, I did find Niko posting a javascript but now I can't find it, which is annoying |
||||
|
I do have a code but that code loads the images(frames) dynamically from outside the coppercube. You might need to create a folder with all of your 100 frames with a suffix of a number in the name. For example frame1, frame2, frame 3 and so on. If you want you can check the code in my dropped project 2D rts clone of age of empires, that project contains a behavior 2d rts unit. And in that behavior you will find a chunk of code which does the animation by loading files dynamically from a folder. Or you can try the behavior gif animator , available somewhere on the forum. Which does pretty much the same thing as my code. Loads images dynamically as frames into coppercube. Here is the link to the post where I posted my dropped project file. https://www.ambiera.com/forum.ph... Hope that helps😇😇 |
||||
|
Hey just_in_case Yeah sorry its a bit crazy but Im still not getting this, as when you create an 2d overlay, you can't set a texture. Unless you set this in behaviour and change a texture. Sorry this part I'm just not getting. I see a previous poster doing exactly what i am after see https://www.ambiera.com/forum.php?t=5034 That is essentially what i want to do |
||||
|
Hello everybody, To Nrasool : Being a CopperCube and JavaScript newbie, this thread was a good opportunity for me to learn more about programming some scripts for this nice game engine. In my shared CopperCube's folder stored on my OneDrive (secured and anonymous access), I uploaded my test with an animated 2D overlay in this subfolder "Animated 2D Overlay". Link to the main folder is still the same https://1drv.ms/f/s!AjokN1FU3jK1... To Vazahat (Just_in_case) : I visited some of your threads posted a few years ago. As I can see you created very nice projects with CopperCube. |
||||
|
Marcw you are an awesome dude!!, Thanks for this, will check it out matey! |
||||
|
Nrasool, thank you for your kind comment. Please proceed as follows for a correct download of that project : - Right click on the subfolder "Animated Texture 2D Overlay" found inside the folder "Animated 2D Overlay" and select the option "Download". Then you'll see a small window asking what to do with the zipped folder. - After having unzipped that folder somewhere in one of your local disks, then you can run the .exe or the .ccb file. In this way, you are sure that those files will find the images stored in the 'paintnet' folder. |
||||
|
Thanks @marcw for the nice working demo. Since I've also been successfully experimenting with Robo's "behavior for animating the texture of an 3D object, with a set of dynamically loaded textures" at: https://ambiera.com/forum.php?t=... I would like to know, if there might be a way to store and load image sequences directly from within Coppercube editor and the compiled .exe project without the need for an external viewable texture folder in order to hide my used project textures from the users? (-> image sequence packed into exe) |
||||
|
@Nrasool 2DOverlays don't have any textures if you see in the materials property of a 2D overlay the inbuilt behavior is programmed to work with 2D overlays as well that is why it works perfectly with 2D overlays, You can't use ccbSetSceneNodeMaterial Property to change the texture of 2D overlays. Instead if you are programming something to change the overlay's texture then you need to use its "image" property. so [ccbSetSceneNodeProperty(2doverlay,"Imagae", imagename.png)you need to use something like this in order to successfully change the image of 2D overlay. @Marcw thanks, yeah there are lots of demos posted by me and they are deeply buried down in these forums. Even I myself forgot what kind of stuff I had posted here already. most of them are still lying in my HDD. @Hadoken yes, You can use images directly from the editor but you might need to modify the code. what you can do is you can create a folder node in you scenegraph explorer and then can add an empty node and apply the texture/image you want to use to that empty node. and make that empty node the children of that node. you can create as many empty nodes as you want with all of your textures supplied to them and put them in the same folder. now you need to modify the code to get the material property of all the empty node and the property type should be "Texture", you can use a for loop to get all the textures, and then supply those texture into the code where it uses the path of an external texture source. that way you don't need to load textures outside of your exe file. hope that helps. |
||||
|
Hello everybody, Hadoken, I post this short comment to thank you for having posted a kind comment about my shared little demo. And about your question relative to the images folder packed inside your published games, Just_in_case's explained his solution. |
||||
|
The way I animate 2D overlay without code: I dust make several different 2D overlays (one for each frame of animation) and then used hide/unhide to switch between them in sequence (every 23ms). |
|