Discuss Scratch

FalconGunner99
Scratcher
1000+ posts

Problems with asteroids game.

So I'm having some problems with my asteroids game, and I'm not entirely sure if its my code or scratch's that is making it happen.
I have it so there are sprites that spawn the asteroids, when the large one is destroyed it puts it's x and y coords into a list and the med spawner spawns two medium asteroids in it's place. the problem comes when the small asteroids are spawned. What happens is the first two that come out when the first medium asteroid is destroyed work fine, but when the second asteriod is destroyed if any of the first small ones still exist then they teleport to the second med asteroid's position when the new small ones spawn.

I've tried a lot of things, from using different sprites for the two couples of small asteriods, all the way to using two different lists for the two med asteroid's coords. it still glitches.

Link to said project: http://scratch.mit.edu/projects/14084354/


; Oh this? This is just my semicolon. I got it a long time ago, it's quite innocuous. Don't worry about it.

















You —> http://i.imgur.com/iVHfwLc.gifv




















derniersamourai
Scratcher
100+ posts

Problems with asteroids game.

Seems that for mid size you have two lists for yx and y.
The second one seems to be empty for ever.
It cannot be filled in qith “replace item 1 with” becaus there is no such item 1 … (lengt is 0)
You can fill the list with two dummy items. Then your “replace” will work.
derniersamourai
Scratcher
100+ posts

Problems with asteroids game.

I forgot the small asteroidis
Both of them use just the first list of medium list of coords x and y
So, you might code that the first one uses the first list and the second uses the second list …

Your game is very good.
Not much code, but excellent effects for the player
scubajerry
Scratcher
1000+ posts

Problems with asteroids game.

I did a remix using 2 costumes, instead of 2 sprites. http://scratch.mit.edu/projects/14117739/

I think this simplifies things.

Powered by DjangoBB