Creating Delayed Object Highlighting

0 favourites
  • 9 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • In my program, the computer will spawn units after the player spawns units. The computer spawns units one at a time, similar to the player. This aspect of the game is working well.

    I want to have the spawn area the computer is focused on to highlight. Right now, every spawn area the computer can spawn a unit on will be highlighted during computer spawning as opposed to one at a time (run the game to see what I mean).

    Here is the relevant code:

    <img src="http://i.imgur.com/wq4qyHB.png" border="0">

    Any help or ideas would be appreciated.

    BoardGame.capx

  • I've done some more testing and decided putting a loop inside a function isn't going to cut it. If I just wanted to have delayed spawning without highlighting, this would have worked just fine, but since I effectively need a delay on two items at once, I think not using a loop is more effective.

    <img src="http://i.imgur.com/rNTbHKt.png" border="0" />

    This is what I have now, and it seems to work much better, although it's still not quite what I'm looking for. I've updated the .capx as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another update. This is very close to what I'm looking for, although I'm still not exactly sure why the second and third spawns are much shorter in time than the first spawn.

    <img src="http://i.imgur.com/lZwzUB9.png" border="0" />

    The .capx has also been updated.

  • Would like to bump this since one of the math wizards (@r0j0hound) seems to be on :D

    The problem: After the player spawns his units, I want the computer to spawn its units. Computer spawning is working, but I'm trying to control the timing so that the computer doesn't spawn all of its units at once but instead sequentially with a slight delay between each spawn. This is made difficult by the fact that I want the currently spawning area to be highlighted.

  • One idea that may make it a bit easier to control is to only let the "ComputerProgramSpawn" function get called when not waiting.

    1. Create another local in the "computer spawning" and call it stall.

    2. Add to event 48 a compare stall=false

    3. And change the wait in event 52 two three events:

    set stall to true

    wait 1 second

    set stall to false

  • R0J0hound

    This definitely seems to work!

    <img src="http://i.imgur.com/fS0RvKu.png" border="0" />

    The other problem I'm having is the highlighting synchronization. The highlight on the first spawn works perfectly, but after the computer spawns its first unit, the other two spawn areas start to highlight even though the spawning only happens one at a time. Any ideas on how to synchronize the two?

  • I've updated the .capx to include a debug counter.

    <img src="http://i.imgur.com/SC2oP5J.png" border="0" />

    The reason why the computer's second and third spawns are much faster than the first is because the ComputerSpawn variable rapidly goes from 2 to 3.

    This causes the highlighting to happen quickly, meaning spawn positions 2 and 3 will become highlighted in quick succession instead of slowly, and I'm not quite sure how to change this.

  • Running out of ideas here. I've tried numerous things, and I'm not sure how to synchronize the two.

    If anyone has ever done something like this (delayed object creation WITH highlighting of the object spawn area), please help.

  • SOLVED!!

    <img src="http://i.imgur.com/v5q1RlR.png" border="0" />

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