>
>
> Yes, I previously did all three parts separately.
> The problem is that I am losing X, Y coordinates in 39 and 40 and I cannot find something to rely upon. A collision of turretBody and a bullet in 40 does not help to define old tilemap coordinates since turretBody is un objet (not tilemap). In 39, I should define again coordinates of the TilemapBoxEnemy after the objet TurretBody is created in the event #37.
> Moreover, in 39 I got a problem with priority of events. I need to make it trigger only if TurretBody (Important: TurretBody from event #37 only) is not destroyed. If TurretBody (from event #37) is destroyed, 39 event is deactivated for TilemapBoxEnemy (in X,Y coordinates of event #37).
>
Im not sure what you mean, I don't see any turretBody in #37 that checks whether its destroyed or not, you mean turretUp? But you create a turretBody in #38.
Its not easy for me to even understand what the code is suppose to do, so this might be wrong. But it seems to me that you rely on or try to use data that you can't really be sure is correct or not. Meaning that you set GetTileX and GetTileY in 37. So if you need to use these coordinates in another event, you shouldn't rely on the data from this one, unless you are 100% sure that they are correct. So if turretBody is created in #38 based on the condition in #37 that "Bullet is overlapping TilemapTurretUp" and then in #40 "TurretBody on collision with bullet2Player" is using the GetTileX and GetTileY in #37 how can you be sure that these are correct? or are there only 1 bullet, turretBody and TilemapTurretUp on the screen at a given time?
If you need something like GetTileX and GetTileY in an event like #40 you should store them in the object it self. In your case turretBody when it is created and only use this when you need to get the tile X and tile y position for that object. Otherwise I think you will end up loosing track of what GetTileX and GetTileY is when you need them.
But as I said im not even sure what exactly you are trying to do. Maybe show some screenshots of what is suppose to happen. But at least to me it seems like you are mixing a lot of objects together without really knowing whether its the correct objects or not or the correct data you are using. How is C2 going to know which turretBody you are referring to in #40 with the GetTileX and GetTileY position you have stored in #37 that rely on a bullet is overlapping a TilemapTurretUp?. If there are only 1 bullet in your game its probably ok, but if there are several bullets GetTileX and GetTileY will constantly be overwritten causing you to not know what is stored in them when you need them.
Also in #40 you are destroying a Turret object that you haven't picked in the event, if that event is ever true all Turret objects in the game will be destroyed.
Whenever you work with an object in an event, unless there are only 1 of them. You always have to pick them or things wont work.
The way I make my events if they are confusing, is to write down each step that I want to happen in them and make each part, that way its very easy to maintain an overview, for instant.
///
A turret consist of 2 parts and if both parts are destroyed the whole turret should be removed. If only 1 part is damage, that part should be replaced with a damaged part until repaired or the other part is destroyed as well.
1. Bullet hit Bottom part of turret
Deal damage to turret
2. Check if Bottom part is destroyed
3. Check if Top part is destroyed
3a. If top part is also destroyed, destroy whole turret.
3b. top part is not destroyed, replace bottom part with a damaged part.
So based on this example I know there are 3 objects involved (Bullet, Top part of turret and Bottom part of turret) so i have to pick all 3 parts to complete the event. And normally I do all picking as early as possible, because then you know you have the stuff you need to complete the event.
I rethought the concept of events.
Here is the starting point
Or it can be like that
So when a bullet2Player overlaps TilemapBoxEnemy,
we identify the coordinates 0,0 and then this event should trigger 2 different actions depending on the condition.
Condition 1: At least one TurretBody is present in any of these coordinates (see in circles)
IF Condition 1 is satisfied THEN bullet2Player is destroyed
Condition 2: No TurretBody is present in any of these coordinates (see in circles)
IF Condition 2 is satisfied THEN bullet2Player is destroyed and TilemapBoxEnemy is replaced with Tilemap1 (set tile X, Y)
So, is it possible to identifiy whether TurretBody is present or not around the TilemapBoxEnemy and how do we arrange these conditions?