B4J Question SetLayoutAnimated End using

ElliotHC

Active Member
Licensed User
In my game I'm generating images that are falling down the screen.

I'm using SetLayoutAnimated and I'm making (image.visible = false) when I'm finished using it.

Is that all I need to do because things are slowing down after my game has been running a while...
 

sorex

Expert
Licensed User
Longtime User
are the images re-used (placed at the top again and dropping) ?

if not you better remove the view.
 
Upvote 0

ElliotHC

Active Member
Licensed User
are the images re-used (placed at the top again and dropping) ?

if not you better remove the view.
Yes, I am using the same images but cycling through 1 = 10 im (ImageViews)

Question is, is just hiding them messy?
 
Upvote 0

ElliotHC

Active Member
Licensed User
I need to make sure I'm clearing down anything in my code. Do you know if there is a section on correctly disposing stuff?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
if you don't create new ones I don't really see why things slow down after a while.
 
Upvote 0

ElliotHC

Active Member
Licensed User
I think I'm creating new ones each time. I guess once I've created that image and want to take it back up to the start once it's dropped..

Is AddNode creating it again, or just moving it?

My App is racking up some serious memory so something isn't right
 
Upvote 0

ElliotHC

Active Member
Licensed User
B4X:
    im.Initialize("C:/Smash","BACKGROUND_SECTION.png")
            SECTION1.Initialize("SECTION1")
            SECTION1.SetImage(im)
            MainForm.RootPane.AddNode(SECTION1,230,Image_Start_Point - 80,614,254)
            Dim jo As JavaObject = SECTION1 ' the imageview
            Dim o As Object = jo.CreateEvent("javafx.beans.value.ChangeListener","moved",False)
            jo.runmethodJO("layoutYProperty",Null).RunMethod("addListener",Array(o)) ' make sure you choose property that will change
            SECTION1.SetLayoutAnimated(Image_Speed,230,Image_Bottom_End - 80,614,254) ' left/right up/down

If I wanted to create the image but keep re-using it, which part of this code do I use again?
 
Upvote 0

ElliotHC

Active Member
Licensed User
Thanks Erel

How do I set the image back to the start position ready for the next animation?

Another animate but with zero duration?
 
Upvote 0
Top