PLEASE HELP! Spawn issue.

Macca_McGillMacca_McGill Member, PRO Posts: 108
edited November -1 in Working with GS (Mac)
Hi,

This is the only bug i have thats stopping me finishing the game and uploading it. My target spawns at a random spawn off screen and moves on screen. On touch u get points etc then its destroyed and triggers a new target to spawn. Every now and again though it wont spawn a new target and causes the user to not be able to play. Can anyone help or would anyone like to look at my project see if they can figure it out?

Thanks in advance guys.

Comments

  • old_kipperold_kipper Member Posts: 1,420
    have you tried spawning to an on scene position and then moving them straight off? Or limiting how far off screen they are spawned? I think there is a limit to how off screen an actor can be to be recognised or it to recognise it's position... I would test it or do a good search around here as I have seen it mentioned.

    kipper
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    yeah ive tried having them spawn in screen instead of off-screen and it still does it every now and again. All spawn points are no more than 20 pixels off screen.
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    im thinking maybe it doesnt like an actor(target) spawning itself when touch is pressed? Is there an easier way to do this?
  • quantumsheepquantumsheep Member Posts: 8,188
    Instead of re-spawning, perhaps just change their x position to offscreen when you touch it?

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    That is a very good idea quantumsheep :)

    So in the rule when touch is pressed...do all the points etc then at the end moveto.random(1,4) as i have a game att that creates a random num 1-4 based on the 4 spawn points. Then just have it move back onto the stage after a second or something?

    Thanks :)
  • quantumsheepquantumsheep Member Posts: 8,188
    No probs.

    That could also help with performance, as you're just spawning the one time, rather than every time you hit a target :)

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    hi quantum, i might still need your help lol.

    I have the game attribute spawn, then when the target is shot i change it to 1 (just for ease of testing, it will be random 1,4 eventually). When the target is shot it interpolates x,y to 0 so it fades out.

    I then have a rule in the target stating if game.att spawn = 1 then move to -30, 100 (so its off screen) at speed 1000. Then a timer saying after 0.5 seconds interpolate back in then move to random location on screen.

    However, after i have shot the target it interpolates out fine. Then it appears to move about 40 pixels down and interpolate back in, then shoots to the -30, 100 at the speed of 1000 and just bounces around the screen lol.

    Please help :(
  • quantumsheepquantumsheep Member Posts: 8,188
    I'm sorry, I've not slept so can't really go into great detail - brain is not working.

    Try using 'change attribute' to change the position to off-screen instead of 'move' as you've described above.

    I hope someone else can assist you further if you get stuck!

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    well i got it working at last, but still every now and again the target just wont appear. i HAVE NO IDEA! lol im gunna give up with it soon :(
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    Well change of plan lol when the user touches the target now it fades out and fades back in at a different spot on screen then starts moving. Works fine now lol.

    Thanks for your help QS :)
Sign In or Register to comment.