Actor spawning one at a time after being collided?
justinodunn
Member, PRO Posts: 226
in Tech Support
After the main character collides with the coin actor, I want it to destroy that coin actor, but spawn a new one at a different random location at the same time, how do I do that?
Comments
it goes like spawner:
for the coin:
However, the coin only spawns once, and once I collided with that coin, nothing spawns again.
You've kind of already written out what needs to be done.
In the coin actor:
When coin collides with main character:
Destroy
Spawn a new coin actor / random X random Y
. . . . .
Example (drag the white actor around)
Link: https://www.mediafire.com/?vb4j8nz8zak41q1
thanks man but I did what you did, however at some point maybe after colliding with the coin 3 or 4 times, the next coin just doesn't spawn at all?
Can you show us a screenshot of your rules ?
Did you try my method ?
yes i am using your method
...
is there something wrong with the random spawning? Do i need to set up a loop?
When coin collides with main character:
Destroy
Spawn a new coin actor / X 160 / Y (Random(0,3)*142)+55
doesn't make a change
could you please take a look at my project? (tap top of screen to move up, and bottom of screen to move down)
The best feedback is often the most vague My favoutire has always been 'nope, didn't work', but 'doesn't make a change' is good too.
I used the logic that I posted above and it worked just fine.
Link: https://www.mediafire.com/?75y4b458d9bkg9z
my bad! but what is this sorcery?! i used the same code but didn't work for me haha maybe its the code in the spawn actor y attribute that I didn't quite understand..
Thanks man
Every actor in your project (every single one!) is unlocked for some unknown reason (unknown to me at least ), so I guess you were changing rules in actors in the Actors window - which would have no effect on the actors in the scene ?
(Just a guess).
hmm perhaps perhaps, i guess there was nothing wrong with the code at the first place, but some silly mistake made, still can't figure out what though. Anyways, thanks for the help, i'll use your logic
My logic follows your logic in that it places the coin in 4 different locations randomly - one of those locations is directly under the main character - you might not want that - as the coin immediately adds a point to the score and then destroys itself (and spawns the next one) - so to the player it will appear that occasionally (actually 25% of the time) they are awarded a point for doing nothing.
You might want to spawn the new coin actor randomly at the three locations the main actor doesn't occupy.
it doesn't really matter this is exactly what i want, as long as it spawns randomly then its fine. my game is simple, once it's done you'll see why i want it this way
Good !
Glad it works for you, be interesting to see what you come up with, I scanned your whole project and there was no mention of 'flappy' anywhere, so all good !!
haha don't worry