dop2000's Forum Posts

  • There are many issues with your code..

    If enemy is not in range or has no LOS, all highlighted events are executed on every tick. This is clearly wrong.

    Also, you need to pick the correct enemy instance in your function, otherwise you are assigning isSearching=true for all enemies.

    "Wait 5 seconds" inside an event which is triggered on every tick also makes little sense.

    I would add a Timer behavior to enemy and do this:

    Enemy NOT overlapping NoticeRange   Function call "StartSearch" (parameter: Enemy.UID)
    and Enemy isSearching=false        
    
    Enemy NOT has LOS to Player   Function call "StartSearch"  (parameter: Enemy.UID)
    and Enemy isSearching=false        
    
    On function "StartSearch"
      Enemy pick by Unique ID = Function.Param(0)
         Enemy set isSearhing=true
         Enemy start timer "StopSearch" for 5 seconds (once)
         Enemy start timer "SearchForPlayer" for 0.3 seconds (recurring)
    
    Enemy On Timer "SearchForPlayer"
        For each Enemy   // as Timer may be triggered for several enemies at the same moment
              ............... find path etc.
    
    Enemy On Timer "StopSearch"
       Enemy set isSearching=false
       Enemy stop timer "SearchPlayer" 
    [/code:1j18ux2j]
  • Sorry, I still don't understand your question.

    You need to populate this array? Should these locations be predefined on each level? Or are they generated on random?

    If predefined, you can read them from a file, say, using CSV plugin.

  • So do you still have the second problem with "Trigger once"? If you do, please share a screenshot of your events.

  • You can try adding Platform behavior to the box, disable standard controls.

    Enable collisions for your Player sprite.

    Then do something like this:

    It works, but requires some tweaking.

    You can slow down both the player and box, disable any animation changes while the box is being pushed etc.

  • Here is a very primitive example, works with rectangular shapes with Origin point set to (0,0) :

    SmallSprite Compare X if less than BigSprite.x  -> SmallSprite Set x to BigSprite.x
    Compare two values -> SmallSprite.BBoxRight>BigSprite.BBoxRight  -> SmallSprite Set x to (BigSprite.BBoxRight-SmallSprite.width)[/code:2snzegm8]
    (similar code for Y coordinate)
    
    If your sprites have complex shapes, there are several things you can do.
    If partial overlapping is ok, you can save SmallSprite position in instance variables oldX and oldY on every tick. If on next tick the sprite moves and no longer overlaps the BigSprite, return its position to oldX, oldY.
    
    Or you can pin a few very small invisible sprites to the corners of the SmallSprite, lets call them detectors. If any of the detectors is not overlapping the BigSprite, return SmallSprite to its previous position. 
    Or you can use the same principle with image points and "Pick overlapping point" event.
  • newt

    Wow, didn't think of that! Great idea, I'm going to use it in my game too.

  • This code should work if ANY instance has boolean set:

    x----------------------------------x
    |Sprite -> Is boolean b set        |  do something
    |System- > Trigger once while true |
    x----------------------------------x[/code:1mpcjwqr]
    
    And it will only be triggered once. If after that you set boolean to other instances, it will not be triggered again.
    If you reset b to false for all instances, and then set one to true, it will be triggered again.
  • No worries!

    I just realized that the blue CarCollision sprite is not necessary in the last example. You can replace it with Car in all events, then delete.

  • Christmas

    Ok, an improved version, should work as you described:

    https://www.dropbox.com/s/0ctlui86sbd4l ... .capx?dl=0

  • Glad it helped!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I fixed it <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    https://www.dropbox.com/s/34dycek87zrwi ... .capx?dl=0

  • I haven't used them myself, but I believe you can draw your colored dots on a Canvas or Paster object. This way you'll have only one object, not hundreds.

  • Something like this maybe?

    System->Compare two values-> abs(angleDiff(player.angle, enemy.angle))>90

  • Make an invisible sprite the size of the car (or a bit bigger for better touch control).

    Add Drag & drop behavior to this sprite. When the sprite Is Dragging, set the car to sprite position, but only if the sprite is not overlapping walls.

    You can pin two invisible sprites together - a bigger one for dragging and a smaller for overlapping checks.

    Also I think you should disable Physics on the car while it's being pulled. Re-enable it when it's released.

  • Try Canvas or Paster plugins: