|
Post by tsh73 on Apr 22, 2018 7:44:59 GMT -5
Re: continuously adding sprites
I tried with a global flag something along
if not(spritesAdded) then addpsrite end if
and after first run (near sort) set it to 1. It worked visually the same.
But it looks like it doesn't affect speed. (and I wonder if it makes a memory leak or not - obviously I didn't run it for long)
|
|
|
Post by Rod on Apr 22, 2018 11:56:24 GMT -5
It does use memory, it will run for a while but not forever. It might also slow down. I still don't understand the need to continually add sprites instead of repositioning existing ones. There is also the removesprite command which is not implemented here but that seems like a totally unnecessary delete and add sequence when the image is already loaded.
|
|
|
Post by bluatigro on Apr 26, 2018 7:20:42 GMT -5
rem : i need to ad the sprites every timer tick because i use my 3D engine to place them otherwise i don't have a idea [ jet ] how i can make joint's
in the beging of [timer] i set s.tel to 0 in add.atom i ad 1 to s.tel s.tel is global so s.tel shoot never be to big !!!
|
|
|
Post by tsh73 on Apr 27, 2018 13:42:15 GMT -5
You can add global flag and do addsprites only if it's not set (that is, first time) After initial run set the flag.
Your sprites are created with same names all the time - so it's enough to create them once.
global spritesAdded ... '------------------ s.tel = 0 call skelet 0 , pend(angle,30) , 0 , 0 ...(whole bunch of things) ... and last one call add.atom 0,-60,-20 , "blue10" spritesAdded=1 'set the flag ... sub add.atom x , y , z , i$ if not(spritesAdded) then #m "addsprite spr" ; s.tel ; " " ; i$ #m "centersprite spr" ; s.tel end if call spot x , y , z s.x( s.tel ) = x s.y( s.tel ) = y s.z( s.tel ) = z s.tel = s.tel + 1 end sub ...
|
|