I giv up. spawn an object after one is destroyed and have it work properly?

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited November -1 in Working with GS (Mac)
Ok, I've been trying this for a total of 6 hours now. and my head is starting to implode.

Basic Info:
Gravity is affecting the scene.
I need a spawned object to follow the rules inside it properly!!
Want to keep the memory needed to a minimum if possible
I have tried numerous ways...and I'm 99% of the way there.

What I wanted (and nearly have):
I have an actor (a block) which when pressed, displays a countdown when it reaches 0 it is destroyed and plays a short png sequence of it being destroyed.
After 2 seconds a new actor block (the same sort) is spawned and falls from the top of the screen.

This all works fine. But the timer on the new spawned block displays '0' rather than the starting value of 15.

If I tell the block to change the value of the object_timer.attribute to 15 before being destroyed, the new spawned block shows '15' but the timer does not go down when touched. Even though the rule exists.

If timer = 15 , for 15 seconds, every 1 second go down 1 number. (it works on the first block).

Originally I had the block actor spawn the new one before being destroyed, and the 1st new spawned actor block worked as it should, but the next one generated after the new one is destroyed did not work. (showed 0 or 15 on spawning as above). I beleive this went wrong because Destroying the actor causes some issues.

now i have it so a separate actor 'sceneControl' which sees if an 'block spawn attribute' goes above 0 it spawns a new block, and minuses 1 from the 'block spawn attribute'. When the block is destroyed after countdown of 15 secs it adds 1 to the 'block spawn attribute'

But the new spawned block does not count down when pressed?

The exploding animation spawns and plays fine.

Anyone, get there head round all the words I've just typed, any ideas?

many many thanks

D3000

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    I don't know your situation, but you could simply move the block back up to the top of the screen instead of destroying/spawning. Reset the counter/alpha etc... when you move it back up.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Yep. Well it's logic like that, that convinces that a new born baby an the lack of sleep that comes with them is bad for your brain cells.

    Cheers firemaple. Will give that a go tomorow.

    Sounds like it would work fine with some tinkering changing some attributes.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    FMG's does sound like the best solution, but another approach could be to have two different that switch back and forth. They would be identical except that they would spawn the other instead of a copy of themselves.
  • synthesissynthesis Member Posts: 1,693
    Advice of the day (optional):

    If plan of attack 1 doesn't work after a while...
    scrap it and try a different route. Usually, after the first attempt...that knowledge will assist you in finding a more logical and more elegant way to approach the problem plus if forces you to rethink the steps needed and possibly simplify those step sequences.

    Don't get stuck in a rut...be flexible.

    I've been coding for 10 years now...rarely is the first approach the best approach...even now after that experience.
  • JGary321JGary321 Member Posts: 1,246
    +1 to what synthesis said. I change things a lot in my games. I go back & realize how easy it would have been to accomplish something in a different way and change things.
  • rebumprebump Member Posts: 1,058
    FMG's idea should work. I think we all established "Display Text" has a bug of not updating properly on spawned objects but works fine on manually placed objects (and thus fall inline with what Joe, err FMG, said).
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Cool. Cheers to everybody . Up now with a sleeping baby so will give fmg's idea a go in a bit.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    As for getting stuck in a rut, I guess that's the best argument for not working on your own, if there is someone else to ask chances are they will see a different route to what is needed. Then you can decide which is best.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Just posting to say fmg's way worked a treat. Game level 1 getting smoother and
    smoother now. Keep tryig to look at it from a fresh perspective. Does it look good, is it fun to play. What can I add? Take away? Etc etc. Still holdin off making the next levels. Just want to get it as spot on as I can.
Sign In or Register to comment.