English tween_frame not working properly - bug?

15 replies
Goto Page
To the start Previous 1 Next To the start
Up
Edik
User
Offline Off
Hello, i want to make an animation trough tweening a spritesheet:

Code:
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
05.06.19 01:49:10 am
Up
Goo
User
Offline Off
CS2D crashes when the spritesheet isnt peak perfect, make sure you're 1:1 on pixels in your code, maybe share your sprite here.
09.06.19 08:41:11 pm
Up
Edik
User
Offline Off
thank you for your answer.
I uploaded my picture:
IMG:http://block-world.de/images/numbers.bmp


this has to be put in the gfx folder. This would be the full code then:
Code:
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
09.06.19 10:25:19 pm
Up
Goo
User
Offline Off
I've tried it, it does the following:

1, 2, 3, 4, 5.

It does not crash.

Make sure that you're using the exact same image, and if you're using a different image post it here.
09.06.19 11:04:41 pm
Up
Edik
User
Offline Off
Here:
IMG:https://s2.imagebanana.com/file/190609/DgW2oDZd.PNG

there is no other code than the one I posted before
09.06.19 11:22:05 pm
Up
Goo
User
Offline Off
As I said, this works for me.
Did you try it in a local server instead? (new game)
09.06.19 11:36:13 pm
Up
Edik
User
Offline Off
If I try it with new game, it does not crash. Probably its a Bug in the dedicated server?
10.06.19 12:31:08 am
Up
Goo
User
Offline Off
Yeah, I get the crash on dedicated server as well.

It should be a bug unless we are missing something.

@user DC:
10.06.19 10:58:30 am
Up
DC
Admin
Offline Off
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)).
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
10.06.19 11:09:24 am
Up
Gaios
Security Supporter
Offline Off
I have implemented that together with @user SQ: with no errors.
IMG:http://i.imgur.com/tmdOQqr.png
10.06.19 06:12:56 pm
Up
Edik
User
Offline Off
@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
10.06.19 06:55:04 pm
Up
DC
Admin
Offline Off
Sure, will be fixed
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
10.06.19 09:14:57 pm
Up
Edik
User
Offline Off
Thanks a lot
It would be also awesome, if there would be an option to make these tweens repetitive.
edited 1×, last 10.06.19 09:36:53 pm
10.06.19 10:13:33 pm
Up
Gaios
Security Supporter
Offline Off
user Edik has written:
It would be also awesome, if there would be an option to make these tweens repetitive.

+
Sth like on/off animation.

And auto shadow for images.
10.06.19 11:29:03 pm
Up
DC
Admin
Offline Off
I added this for the next update:
cs2d lua cmd tween_animate
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
11.06.19 07:20:02 pm
Up
Edik
User
Offline Off
This is awesome √ *Thumbs up*
To the start Previous 1 Next To the start