Forum

> > CS2D > Scripts > tween_frame not working properly - bug?
Forums overviewCS2D overview Scripts overviewLog in to reply

English tween_frame not working properly - bug?

15 replies
To the start Previous 1 Next To the start

old tween_frame not working properly - bug?

Edik
User Off Offline

Quote
Hello, i want to make an animation trough tweening a spritesheet:

1
2
imgid = image("<spritesheet:gfx/tiles/cs_assault.bmp:32:32:m>",player(id,"x"),player(id,"y"),3)
tween_frame(imgid,2000,4)

Im not using "cs_assault.bmp" of course. But if im using this code, it loads 4 frames, then it jumps to the next frame and then the server alerts with "EXCEPTION_ACCESS_VIOLATION" and quits. Any ideas whats wrong? Could it be a bug?
edited 6×, last 10.06.19 09:52:08 am

old Re: tween_frame not working properly - bug?

Edik
User Off Offline

Quote
thank you for your answer.
I uploaded my picture:
IMG:https://block-world.de/images/numbers.bmp


this has to be put in the gfx folder. This would be the full code then:
1
2
3
4
5
6
7
8
addhook("say", "saytest")
function saytest(id,msg)
	if msg == "!a" then
		imgid = image("<spritesheet:gfx/numbers.bmp:32:32:m>",player(id,"x"),player(id,"y"),3)
		imageframe(imgid,1)
		tween_frame(imgid,2000,4)
	end
end

after saying "!a" ingame, it makes: 1,2,3,4,5 *crash*

if you check the image dimension, you will see that 32px fits exactly 5x2 times in it.
edited 2×, last 09.06.19 09:14:39 pm

old Re: tween_frame not working properly - bug?

DC
Admin Off Offline

Quote
Probably a bug. I don't know. I didn't implement that

BlitzMax does crash however if you're trying to access a sprite frame which does not exist. So whoever implemented this feature did not add any extra checks to make sure it never explodes.

The image here has 160x64 pixels
160 / 32 = 5
64 / 32 = 2
5 * 2 = 10

So you should be able to use frames 0 to 9 (NOT 10 because it starts at 0)

For the dedicated server we have empty dummy code for graphics because no rendering is required. It's very possible that this part is not faked properly and that the code tries to access something which doesn't exist (= the animation frame(s)).

old Re: tween_frame not working properly - bug?

Edik
User Off Offline

Quote
@user DC: Will there be a fix in the next release? Because else there will be a lot of packets sent, if you want to animate many sprites and do it manually. And if you want fast animations, it will sum up to a lot. A fix could improve it a lot
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview