This site requires JavaScript, please enable it in your browser!
Greenfoot back
OfficerRiot
OfficerRiot wrote ...

2018/4/27

Problem With actor Spawning

OfficerRiot OfficerRiot

2018/4/27

#
So I have a character selection screen so when I press it he spawns in but everytime I click space it seems to add another actor onto the current one but when I just add him manually nothing like that seems to happen its super weird.
Yehuda Yehuda

2018/4/27

#
So what are you trying to say (that "it's super weird")?
danpost danpost

2018/4/27

#
It is not super weird, and not even surprising. Remember that any action code is executed many times per second (usually about 60). When pressing and detecting a downed key, even if you just tap it quickly, the code will almost always execute two or more times (it takes a lot of time in terms of computer speed for a key to be pressed and released). Therefore, you need another condition (the first being that the key is down) to regulate the spawning of the actor. A second condition that should work might be that no object of the type being spawned are currently in the world.
You need to login to post a reply.