• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows png strip not animated[SOLVED]

W

Wraithious

Guest
hi, I'm loading a png strip into my game and it displays the whole strip instead of it being animated, anyone know what might be going on with this? heres my code:

Code:
//step event:
global.pic1= working_directory+"\Roadhammer Gaming\Mergery\"+string(keyboard_string);
//typed in bouncy_strip53.png

//Press enter event:
if(global.saveorload=1)
{sprite_replace(sprite9,global.pic1,0,1,0,(bbox_right-bbox_left)*0.5,(bbox_bottom-bbox_top)*0.5);
}
it loads the picture but it displays it as all 53 subimages side by side, the manual says it's supposed to load it in as an animation.
I tried building the game, installing it on my computer and it does the same thing
 
W

Wraithious

Guest
nope, same exact result.

Code:
//enter
global.addasprite2=sprite_add(global.pic1,0,1,0,(bbox_right-bbox_left)*0.5,(bbox_bottom-bbox_top)*0.5);
sprite_index=global.addasprite2;
image_single=0;
 

TheouAegis

Member
Report it as a bug and upload your project to the bug database. I told them the _stripXX function wasn't working but didn't have a copy of the test project for them. Rather than just doing it themselves, they wanted me to upload a demo and I didn't feel like messing with it.
 
W

Wraithious

Guest
Report it as a bug and upload your project to the bug database. I told them the _stripXX function wasn't working but didn't have a copy of the test project for them. Rather than just doing it themselves, they wanted me to upload a demo and I didn't feel like messing with it.
ok thank you I'll do that
 
W

Wraithious

Guest
you're saying you have 53 sub images, so why is the second argument 0? Are sure you're using a .GIF?
the png I'm trying to import is 11342 x 197 in pixles.

if you divide that out tho it is allmost 60, let me give you more info on why that may be, I took an animated gif file awhile back, loaded it into gamemaker, then exported it as a png strip to use later, it named this file bouncy_strip53.png which would sugjest that there are 53 sub images, but the division says differently, I also have another sprite that i used for the above example that is 1152 x 68 and named tcsfritti_strip11.png, dividing out to 16.9, this also did not import correctly, I think I see a problem in the file name because the tcsfritti_strip11.png should be 16 not 11, and the other original pic i tried should be 60 not 53

EDIT#2
ok I tried changing the name of the file to to tcsfritti_strip16.png, that didn't work so I adjusted the actual picture size to 1088 x 68 because that divides out evenly, That did NOT work either so it's definatly a bug because if I load the same strip in the add sprite method (not in code) it works perfectly fine
 
Last edited by a moderator:
W

Wraithious

Guest
EDIT: deleted this last post, jpg and gif load ok, I'm going to send the error report on the png strip error tho.

GIF does load from file but cannot be animated!!!


Heres the error report example I have sent if anyone wants to see what I'm talking about.
it's an editable .GMZ complete Zipped folder:
https://drive.google.com/open?id=0B4uEFC9Ii8BnWlNaUHBOX3M3V1U
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
There is no bug here. Everything works the way you defined it - but the way you defined it may not be the way you want it to be.

You're loading an image with 53 subimages (or however many there really are in it - that's something only you can know, though) but set the imgnum argument to 0 (rather than, well, the amount of subimages in the sprite). The result of doing this should be no surprise. (Actually, it should... since you specified that you want no subimages, yet you're getting one, but I hope you see my point either way.)
 
W

Wraithious

Guest
@TsukaYuriko but it has been set to 0 the whole time and was never set to 53
Please check out my example you can download,
unless you mean in the name of the file it'self?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Exactly that is the problem.

You are not specifying the amount of subimages (setting it to 0).
You should be doing that (setting it to 53, or whatever the amount of subimages is).
 

DesArts

Member
Tsuka explained it extremely well, but simply put for you since you're finding it hard to understand

//step event:
global.pic1= working_directory+"\Roadhammer Gaming\Mergery\"+string(keyboard_string);
//typed in bouncy_strip53.png

//Press enter event:
if(global.saveorload=1)
{sprite_replace(sprite9,global.pic1,53,1,0,(bbox_right-bbox_left)*0.5,(bbox_bottom-bbox_top)*0.5);
}

See the bold part? That's what it should be, the number of images.
 
W

Wraithious

Guest
Ahhh ok I get it now ill try that, and if its an GIF do it that way as well?


sorry im a little dislexic and thought everyone was telling me i was setting it at 53 and to set it to 0, and the time i was setting a sprite origin i was going by (bbox_left + bbox_right)*0.5 instead of the correct way (bbox right-bbox_left)*0.5 hahaha thank you guys alot!! and for being patient with me thanks again!!!
 
Last edited by a moderator:
W

Wraithious

Guest
To quote the manual:
ok I did do the gif correctly but I can't animate it, but thats probably something I'm doing wrong, I'll work on it and see what happens, this is my code for that:

enter pressed event:
Code:
if(global.loadpng=7 && canload=1)
{
if sprite_exists(global.adme) sprite_delete(global.adme);
global.pic1= working_directory+"\swirl.gif";
global.adme=sprite_add(global.pic1,0,0,0,0,0);
sprite_index=global.adme;
global.loadpng=8;
canload=0;canspin=1;
alarm[2]=10;
}
alarm[2] event:
Code:
canload=1;
sprite_set_offset(global.adme,sprite_width*0.5,sprite_height*0.5);
step event:
Code:
if(canspin=1)
{
canspin=0;
image_index+=1;if image_index>99 image_index=0;
alarm[1]=20;
}
alarm[1] event:
Code:
canspin=1;
 
W

Wraithious

Guest
Why not use the default sprite thing?
Im making a graphics game that you can load your own images in, blend them together with alpha (and many other effects), move them around and modify them, and take a snapshot of the end result, + a boarder line maker, it's going to be very usefull when making background boarders or skeletal animations, for example you can take an animated pic of your character, load it in, sketch out all the body parts and theese are saved so you can do what you want with them

Heres a look at my project:
 
Last edited by a moderator:

TheouAegis

Member
Oh they changed the docs. At one point the docs did say _stripXX worked with sprite_add and i reported that to them.

Or was it gifs not loading that i reported? Meh. Whatever.
 
W

Wraithious

Guest
Oh they changed the docs. At one point the docs did say _stripXX worked with sprite_add and i reported that to them.

Or was it gifs not loading that i reported? Meh. Whatever.
It must of been the GIF's, while i can get them to load i cannot get them to animate, if i go against setting everything to 0 in the sprite add function and set the image_number to 1/2 the number of sprites or greater it animates but shrinks the visible view of the gif to allmost nothing and only visible on the sprites left side
 
R

Robert

Guest
Im making a graphics game that you can load your own images in, blend them together with alpha (and many other effects), move them around and modify them, and take a snapshot of the end result, + a boarder line maker, it's going to be very usefull when making background boarders or skeletal animations, for example you can take an animated pic of your character, load it in, sketch out all the body parts and theese are saved so you can do what you want with them

Heres a look at my project:
For some reason I can't watch the video? I don't have problems like this with Youtube normally so I wonder what is going on... It just spins forever like it's trying to load. Anyways, maybe a bit off topic but I was wondering if you are doing anything special to fix the texture paging from adding sprites dynamically? If you are not sure what I am referring to whenever you add a sprite dynamically, as in after the game has compiled, I believe it adds this new sprite to it's own texture page, which means for each dynamic sprite that gets added you have to swap to a whole new texture page for it. So if you only have one or two of them it's not a big deal really, but if you have over 5 I would think you might need to fix this, however it's overly complicated and I haven't found a good easy way to do it correctly, which sucks because I really would like to have modable artwork in my game.
 
W

Wraithious

Guest
For some reason I can't watch the video? I don't have problems like this with Youtube normally so I wonder what is going on... It just spins forever like it's trying to load.
hmm that's weird, I uploaded it and made sure it was public, it's a .FLV format, but it works on my phone and computer so I don't know? you could try going to my UTUBE channel directly, search on there for my user name: tomcat637
I was wondering if you are doing anything special to fix the texture paging from adding sprites dynamically?
I only have 2 sprites that can be modified by the user, the background and the foreground, I have been reading up on texture pages some but havent messed around with them yet but I'll have to build my game and make sure it works correctly, I have added the if sprite_exists() sprite_delete function before loading the new sprites from file tho so it won't cause a memory leak
 
Last edited by a moderator:
Top