Animating instance in initializing method

Report bugs. Post bug workarounds or fixes

Moderator: MSandro

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Animating instance in initializing method

Post by MSandro » Sep 22nd, '17, 21:32

Hi, today I've tried to create a class which should initialize some "instances". The instances should have an animation while they appear.
But this doesn't work. The animation is not visible! The instances are appearing all togather after the inizialisation method is finished.

I think it seems to be a bug, or maybe there is something wrong with my code:
inizialisation.PNG

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Animating instance in initializing method

Post by SimpleSi » Sep 22nd, '17, 22:23

I had a similar situation in a project.

John explained to me that an instance is not placed on the stage until the initialise method has finished

The way to do it to create the instance and then broadcast a message

Each instance can then respond to broadcast and start doing stuff

Simon

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: Animating instance in initializing method

Post by MSandro » Sep 23rd, '17, 08:34

Thank you for your help. Now I tried this:
initialization2.PNG
It is animating the GP logo, but it shows an "ship" image instead of my defined background ...
Attachments
Inizialisation-Test.gpp
(14.83 KiB) Downloaded 310 times
Last edited by MSandro on Sep 23rd, '17, 08:52, edited 1 time in total.

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Animating instance in initializing method

Post by SimpleSi » Sep 23rd, '17, 08:41

Hi
I think you've uploaded the old project and not the one in the picture
Simon

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: Animating instance in initializing method

Post by MSandro » Sep 23rd, '17, 08:54

Sorry, now it should be the latest.

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Animating instance in initializing method

Post by SimpleSi » Sep 23rd, '17, 09:54

I think this is what John suggested to me - make sure all instances are initialised - then do the broadcast


Inizialisation-Test-sw.gpp
(16.89 KiB) Downloaded 289 times
Attachments
0.png

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Animating instance in initializing method

Post by SimpleSi » Sep 23rd, '17, 09:55

PS your method of responding to keypress doesn't work for me - I'm going out but will test more later

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: Animating instance in initializing method

Post by MSandro » Sep 23rd, '17, 09:59

Thank you very much for your help.

Yes I know.

Edit: while I waited for an reply in this topic, I tried around a bit with "functions".

This is my solution combined with your suggestion:
Inizialisation3.PNG

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Animating instance in initializing method

Post by SimpleSi » Sep 23rd, '17, 12:08

To fix main class I had to delete it and re-create it - it now works OK
Attachments
scriptImage.png
scriptImage.png (2.81 KiB) Viewed 7391 times

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: Animating instance in initializing method

Post by MSandro » Sep 23rd, '17, 16:51

Ah, now I know, it doesn't work in "helper" classes!

Post Reply