dop2000's Forum Posts

  • Here is a demo:

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

    And another one with several different methods of spawning:

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

  • The easiest way to do this is to put a bunch of invisible sprites - SpawnPoints.

    Then you can do something like this:

    Every 2 seconds
    Repeat round(random(10,15)) times
         System-> Pick random instance of SpawnPoint :  SpawnPoint spawn Enemy
    [/code:2v7a2cd3]
    
    This code is not very good because the same SpawnPoint may be selected several times and spawned enemies will overlap.
    A better solution would be adding Timer behavior to SpawnPoint. Each SpawnPoint instance will be running its own timer and spawning enemies on timer event. 
    You can also add a condition to check if there are other enemies within X pixels from the SpawnPoint before spawning a new enemy.
  • Try "For each" as a sub-event:

    Door overlapping Ground
        For each Ground      ....
    [/code:2olscttg]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure if this advice will be helpful..

    In my game, which is also quite a big project, I have lots of separate event sheets for different things - Audio, Background, Enemies, Shop, Coins etc.

    Almost all of them have "Init()" function, which resets static variables, enables/disables groups and does other things like that.

    On start of each level I call these functions - BackgroundInit(), EnemiesInit() etc.

    This helps to keep things organized.

    Changing state for several hundreds of groups at once doesn't seem like a good idea.

    If you think it's the only way, you can try this:

    Make a list of all groups. (to automate this task you can search for "event-group" tag in .xml files of the project using software like Notepad+)

    On start of the game, loop through this list and save the initial state of each group in an array or dictionary.

    Then you can use this data to reset all groups to their initial state.

    Or you can include the default state into each group's name. For example "Player controls #D", where "#D" at the end means "disabled by default".

  • I made this demo for another post recently:

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

    You'll need CSV plugin to open it:

    plugin-csv-csv2array-csv2dictionary_t64326

    As for the button, you can change its appearance with CSS, but I prefer using sprites.

  • Can you try this -

    Create a new empty layout, set it as first layout in project properties. Then preview your project on mobile. Will it still take 4 minutes?

  • I don't have an answer for you, just curious - how slow is it?

    My capx is 15Mb and takes about 5 seconds to load when previewing on my Android phone.

  • Put A and B on the same layer, B above A.

    Set blend mode for B to "Source in"

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