> nimos100,
>
> I am wondering what's wrong with the sequence of the following code:
>
> When a turretBody appeares , I want to trigger the following events:
> 1) If turretBody is destroyed with the bullet2Player, tilemapBoxEnemy is replaced with Tilemap1
> 2) If turretBody is not destroyed, bullet overlaps TilemapBoxEnemy and bullet is destroyed
>
I think the problem is in your structure of the code, meaning you are trying to do to many things in one event that would be better splitting up into several events. So there are some things that to me looks, not to good.
Using "Create" together with other "Actions" in C2 can be a bit tricky, because you have to be careful about top levels and sub levels and know how it works to avoid problems with the "Create" action. But think everyone runs into this problem at some point.
Your newly created object is not available before you get to a new top level. but will be available in sub levels from where it is created.
So this will cause some problems as I see it, because you create the turretbody in a sub level, but you haven't reached a top level when using the "On collision with Bullet2Player" so the turretBody doesn't exist at this point. Another thing is the "On collision" which is a "trigger" or what to call it, indicated by the little green arrow, and it triggers whenever an collision happen that meets its condition in this case a collision with bullet2Player, so it works the same way as a mouse click on an object does. In my experience any such trigger should be placed on top level and not within a sub event. So in your case I would move the "On collision" to its own event and restructure your code so it works with it being there, and then it will most likely sort it self out.
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).