Preview mode and Debug mode plays differently...?

0 favourites
  • 11 posts
  • So I discovered this weird behavior and I don't know if it's my mistake or a Construct 3 bug.

    I made a simple test project where you can control this diamond-shaped player by clicking anywhere for it to teleport instantly to that point. There are circle-shaped enemies which you can kill by casting a laser(which I named LineExecution) at them, by obtaining the item in the middle. If you look at my event sheet, theoretically, when the player touches the item, it should cast lasers to all enemies and play the correct sounds. This works perfectly in Debug mode. But in normal Preview mode, when I click and move the player to certain places, it doesn't work correctly and only plays the sound. The image of the item was one of those places. (The player is big enough to touch the item even if I click somewhere near the item)

    First image is the Preview mode, Second is Debug mode. Both were took immediately after I clicked on the image of the item.

    This is the way I move the player, in case it matters. Ignore the 'MovesLeft' and 'StartX/Y' stuff

    The speed of the player is set to 100000. The reason I did that instead of just setting the position is because I wanted the player to pick up the item if it travels through the item.

  • You have Picking Problem

    You create the lines in a separate event >>>> Event 22 But you don't link the enemies to that lasers so it doesn't know to who belongs to

    On Event 24 you have the same Picking problem as you pick all the enemies in one go but you don't specify which lasers belong to which enemy unless you have the objects in containers.

    So the best thing to do is make all the events in one, for example in the function event 22:

    Enemy is on Screen

    ">>>>>>Sybevent": For each Enemy: Create the Lazer + Move the actions from event 24 here, after the action that creates the laser + also you can add play the music action here so it plays for each enemy or if you need to play the sound just once then move that action outside the loop but inside the function.

    Not sure why it will work on debug though as it should fail swell.

  • Not exactly the answer I was looking for, but thank you very much for your advice.

    However there is a flaw in your code... The lasers get created properly but they don't follow the player afterwards. I thinks it's because when you use 'for each enemy', it only performs the action once for each enemy.... Here's the code:

    What I want is this:

    1. When the player touches the item, it creates lasers for each enemy on the screen. Only them, not other enemies that appear later.

    2. Wherever the player and the enemies are, the lasers keep attached to them when they move

    3. After a certain time the enemies who were attached with lasers get destoyed.

    My best try was the image from up there but as I said it sometimes wouldn't create the lasers for whatever reason and also when it did, the lasers would lock on to other enemies as you mentioned.

    I know it's a bit too much to ask for but I would love to get some help.... I'm very new to Construct.

  • oops forgot to upload the image of your code

    here it is:

  • I see

    I didn't know you had problems with the movements swell

    You can Pin the objects and set the Angles

    Here's one way of doing it see if it helps:

    If I understood when the player touches the little circle (PowerUp) you create the laser for all the enemies on the screen and after 3 seconds you destroy the enemies that were touch by the laser only, plus the lasers, but not an enemy that came after.

  • OMG WOW!!!! I seriously didn't expect you to create everything for me...! THANK YOU SO MUCH YOU ARE MY HERO

    I almost feel guilty to use this lol

  • OMG WOW!!!! I seriously didn't expect you to create everything for me...! THANK YOU SO MUCH YOU ARE MY HERO

    I almost feel guilty to use this lol

    No worries it was easier for me to make it than if I had to write it down as it will be some back and forwards explaining. ))

    Glad you fixed

    Ho I upload yesterday the capx that I didn't clean by mistake so you have there a few conditions that it doesn't do anything really, if you can redownload please from the same link, I apologise for that, it should be correct now. Is the same thing I just removed the two conditions from event 14 as it was meant to calculate the laser (Width & Angle) from the enemies but I changed the last minute to calculate it from the laser (X,Y) instead, as they were pinned anyway avoiding extra checking.

    Good Luck

  • It works really well, thanks again!!

    I just want one tiny thing to make it even better though...

    I tested your project and everything was fine, but whenever the enemies were cramped up, the lasers attached to them looked a bit weird. Look at the image and you'll understand.

    What I want is this:

    I tried to fix it using the 'set Z elevation' on the laser object and setting it to 'enemy.Zindex', but sadly it didn't work...

    sorry for keep asking for help haha but you are too good at this!!

  • oops the first image is gone here it is

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can add a few Actions:

    -Event 12 after you create the laser you can add a move in front of the enemy Action for that lasers

    -Event 18 you can add an action move to the Top of the layer to the enemies so the new enemies they are always on top of the layer as if they where Spawned

    Like this:

  • Perfect. I learned a lot from you thank you very very much!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)