dop2000's Recent Forum Activity

  • Uglypenguin

    I forgot one thing - in the first two events you need to add "For each enemy":

    Enemy NOT overlapping NoticeRange   
    and Enemy isSearching=false   
        For each enemy                    Function call "StartSearch" (parameter: Enemy.UID)
    [/code:10fox8yi]
  • Is the function on the same event sheet? If it's on a different event sheet, you need to Include this event sheet.

    If this doesn't help, could you share your capx?

  • You can use Browser.Log -> Array.AsJSON to get the correctly formatted JSON string. All you need to change is to double all quotation marks.

  • Try this:

    Array Load from JSON   
    Copy/paste this string:
    "{""c2array"":true,""size"":[10,2,1],""data"":[[[60],[150]],[[60],[265]],[[60],[380]],[[0],[0]],[[0],[0]],[[0],[0]],[[0],[0]],[[0],[0]],[[0],[0]],[[0],[0]]]}"
    
    [/code:2ecaytek]
  • I'm trying to reply to a post and keep getting "SORRY YOU HAVE BEEN BLOCKED" error.

    Here is my comment:

    After many attempts and edits the forum finally allowed me to post it.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.
dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 250 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x4
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies