Still having troubles with the enemies.

I am still having trouble with my Enemyships. I have 2 SS’s. Labled Enemy1 and Enemy2. Now Enemy2 is the way I HAD ENemy 1 through 4. When they did not work. I deactivated Enemies 2-4 and changed Enemy1 to what you see here.

Enemy1, in both cases DID spawn. But one of three things would happen:

The enemyship would spawn and function some what how I wanted it to. Enemyship would come at Playership Kind of in a direct line, but not truly pointing at Playership. Once Enemyship got close to or just past Playership it would then start firing, and THEN turn to truly be pointing at Player ship.

After 4-8 Enemyship kills (That is Enemyship destroyed by Playerships ammo) They Enemy ships would either stop spawning all together or continue to spawn but refused to take any damage even though there was collission but the Playerammo with both sound fx and delete playerammo.

The third instanfce, I would get no enemyships at all.

Anythoughts?

Your event:
Do=120 to EnemyHP
Do = 0 to EnemyFirerate
Do = 0 to Enemycreation
is always true, because there are no conditions on it, so this is happening all the time.

Should I add the Condition "At the begining of the scene?

If you want these to be default values for these variables, I would edit the enemyship object to have these as default values. Right click on sprite → Other properties → Variables → Declare the variables there and set what you want as start values. Now every enemyship upon spawning, will have those values for those variables.

I have done that and still having issues. How do I get a zip file out to you guys to see what I am doing wrong? Everytime I try to upload it the page times out and resets.

I have gotten to the point where Enemy1 will spawn as close to normal as possible I guess. Abywhere between 5 and 20 enemy ship kills, the enemy ship stops spawning. This I have noticed happens on a set sequence of number of enemy ship spawns; 4,5,7,8,15,20. At either of these spawn numbers, the Enemyship just stops spawning. I can sill shoot the other objects in the game and they continue to spawn normally. I have not been able to get Enemyship 2 to spawn at all. Enemy ships 3 and 4 I have removed from the code until I can fingure out what in the hell I have done wrong.

Let me know.

I really do appreciate all of the advice and help all of you have offered to me :slight_smile:

Thank you so much.

You can upload a zip file with your post by clicking on Upload attachment, which you will see in the bottom left corner when you are writing your post.

Here, I think I figured out the whole Cloud FTP thing.

onedrive.live.com/redir?resid=B … ile%2c.zip

Ok… In future, please put more comments in your code! I took a couple of screenshots of a game I’m working on at the moment to show you how many comments I think is a good amount:

This makes it easier for you to know what is happening as the code grows larger and larger, and makes it way easier for people to give you help if you need to show them the code, or if you come back to the code some weeks or months later to make changes. Also, make sure your comments make sense. Having the comment ‘Collisions’ followed by three events in a row that are actually spawning objects using timers and have nothing to do with collisions at all is confusing.

Now let’s go through the code:

At the beginning of the scene : Set time to scale to 1. Not necessary since time scale will be 1 anyway.

Variable EnemyFireRate of Enemyship is >= 0 : Do +1 to Variable EnemyFireRate Why is this here? You know these are two different variables?

What you should have done (and should now do in future) is made just one enemy, that has the functions that all enemies will have. Make sure that works, and only then add the other enemy ships, re-using as much code as possible from the first enemy. In fact, I would suggest removing all ships except one and doing exactly this now.

To spawn enemy ships just use create object Enemyship, not what you are currently using. You might notice that function has strange conditions too.

Variable(Enemycreation >= 0) : Do +1 to variable(Enemycreation) ← So this condition is always true.

Variable(EnemyHP is > 0) I couldn’t see this variable being changed anywhere?

The number of Enemyship >= 0 So if I kill all enemy ships, no more will ever spawn. Is this what you meant to happen?

I think I have managed to fix your problem. I have uploaded the fixed project file with this post.

I don’t know what is the purpose of checking the value of that variables when you create enemies, so I have deleted all of them from condition and simply create enemies every 1.5 sec and I have created a scene variable to count created enemies, but I think there is also an event in GD to check number of objects in a scene if it something you want to do. Also, no point to use for each object event to create the object. Create enemies in a single event, and move, rotate enemies in for each object event.
For enemy2, you have typed wrong the name of the object in for each event, I think, that is the reason why it not created but I’m create enemy2 the same way as enemy1. I have commented all changes by using red comments. :slight_smile:
Fixmeplease(FIXED).gdg (242 KB)

This is at - Conditions → All objects → Objects → Number of objects