-
Posts
6 -
Joined
-
Last visited
Everything posted by ixdHenry
-
Thanks guys, I'm going to re-think the logo design or simply lower the output on Blender.
- 3 replies
-
- pixi
- spritesheet
-
(and 1 more)
Tagged with:
-
I am trying to learn how to make a sprite from a spritesheet and I'm following Kitty's tutorial as a reference on how to work with spritesheets. https://github.com/kittykatattack/learningPixi#sprites I am using Texture Packer to create my spritesheet. I was successful in exporting all my images the only thing that has me confused is why do I have a .json file for each of my images? I suspect this is because I had to enable multipacking because all my images wouldnt fit on one sheet. In a lot of the examples I've seen online most devs just import one tile-sheet and one .json file. I was expecting Texture Packer to do the same, now I am unclear how I would import all of this...just for one sprite. Is there a better method of doing this? Quick info about the images I am using, I made a 3d render in Blender and exported the final render into .png frames, the size on each frame is roughly 2000x1000. Perhaps there's another way I could export my render and have it ready for PIXI?
- 3 replies
-
- pixi
- spritesheet
-
(and 1 more)
Tagged with:
-
@ivan.popelyshev Ah i see why you suggested I read a java book, I didn't know what a constant was, i thought var was the only way of doing that lol. Useful to use in this situation I see. Thanks @themoonrat for clarifying that, i was able to get the timer going!
-
That still doesn't help multiple text objects are created every time the timer is incremented. What other way can I go about adding one text object on the stage and having it dynamically update during render time? The reason I'm seeing multiple copies is probably because I keep adding the object to the stage. function countDown(){ ...//getting the time code //font styling var timerStyle = new PIXI.TextStyle({ fontFamily: 'Times New Roman', fontSize:1000, fontStyle: 'normal', fontWeight: 'light', fill: ['#ffffff'], // gradient }); countdown = days+" days "+hours+" hours " +minutes+" minutes "+seconds+" seconds "; duh = new PIXI.Text(countdown,timerStyle) timerStyle.x = 100; timerStyle.y = 300; timerContainer.addChild(duh); timerContainer.x =timerStyle.x; timerContainer.y =timerStyle.y; timerContainer.scale.x = timerContainer.scale.y =3.7; }, 1000); }
-
My issue here is I'm trying to create a countdown timer using fonts and styling of my choice but I don't know how to update the text variable. I want to call the addChild method once and have the value of that string updated in a function. The only way I can see the updated countdown is with the addChild method but at the moment that leaves duplicate copies of the object on the screen. The render does not clear the canvas even though I read in the documentation it's set to do that by default. I tried two methods to get the desired results: var countdown = new PIXI.Text( days+" days "+hours+" hours " +minutes+" minutes "+seconds+" seconds ",timerStyle); countdown.updateText(); timerContainer.addChild(countdown) //tried a second method and that was use to create a sprite from the text textSprite = new PIXI.Sprite(countdown.texture); timerContainer.addChild(textSprite); I did some extensive google searching and I learned that you need to use the function .updateText(); in order for the text variable to actually update. I thought this would work but it does nothing to change the string value on the screen. I have also tried to declare and add the countdown variable to the stage, outside the function but the text does not update. Any suggestions would be greatly appreciated.