dop2000's Forum Posts

  • I've never had this issue on Android. Can you share a demo apk?

  • What you did is not right, the new code has essentially the same problem as in your first comment. If there are several bad troops within 500px from the good guy, the first badtroops instance will be picked as a target. Not necessarily the nearest. And if several good guys see the same bad guys, they will all pick the same one badtroops instance.

    Also, there is no point in using TargetUID variable if you are refreshing targets on every tick. The whole idea is to prevent this - once a goodtroop has a target, it will stick to it and will not be distracted by other targets.

    Picking by comparing distance is the same as using LOS behavior, but the LOS behavior works faster.

    Finally, your events 8 and 9 are also very wrong. They shouldn't be nested inside the loop. I suggest using Timer behavior to shoot a bullet.

    Here is how I would do the whole thing:

  • You should probably use For Each loop if you want to assign a target for every good troop.

    For Each GoodTroops
    GoodTroops has LOS to BadTroops
    BadTroops pick nearest to GoodTroops
     .... GoodTroops Move To BadTroops
    

    But this may not work very well if there are several bad guys roughly at the same distance from the good guy - it will constantly switch targets.

    A proper solution would be saving the target UID in an instance variable on the GoodTroops. Once the target is selected, the good guy will move to it and ignore other targets until its target is destroyed. You can add other conditions to allow changing the selected target, for example, if another enemy has spawned much closer.

    .

    By the way, there is a mistake on your screenshot - in the first action you have Move To (Badtroops.X, Badtroops.X)

  • When you are using a condition like GoodTroops pick nearest to BadTroops.x/y, it will check all instances of GoodTroops, but only one (the first) instance of BadTroops.

    I suggest giving your family a Line Of Sight behavior and using it instead - GoodTroops has LOS to BadTroops.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Directly loading an image into a drawing canvas is still not possible. And doing this via a snapshot will be very slow. Can you paste canvas A on canvas B? This will work much faster.

  • Are you talking about a web game run in a browser on Android, or an Android app (apk)?

    I've never seen this issue in an apk. If this is a browser game you can use Chrome remote debugging to see if there are any error messages in the console log.

  • You are using Local Storage events wrong. Check out the official example:

    editor.construct.net

  • Sorry, you are right, I didn't that there are different lists.

    Even in Russian I don't understand your problem.. Can you post a demo project?

  • If both sprites are rectangular, you can use this condition:

    SpriteA.BBoxLeft<=SpriteB.BBoxLeft & SpriteA.BBoxRight>=SpriteB.BBoxRight & SpriteA.BBoxTop<=SpriteB.BBoxTop & SpriteA.BBoxBottom>=SpriteB.BBoxBottom

  • As Ashley likes to say, Answer your own performance questions with measurements :)

    How much data are you talking about? If it's less than 1MB I wouldn't worry about it at all.

  • You have duplicate "кто_написал2 Add item" actions on your screenshot.

    Also, "stop loop" after a delay will have no effect.

  • You can do this with blend modes, see this demo:

    howtoconstructdemos.com/cut-an-image-into-pieces

  • Noticed another mistake in the "For X" loop - it should be from 0 to tokencount(..)-1

    Other than that I don't know what else can cause duplicate entries in the list. Add console logging to double check that Photon sends the correct data, and that this event only runs once.

  • If you want to prevent adding empty strings to the list, the second cycle is not really needed. You can just add another condition to the first loop - that the tokenat(....) is not equal "".

    I don't know why there are duplicate people in the list. Either this data comes from Photon, or maybe added to the list somewhere else in your code.