dop2000's Forum Posts

  • Never ever use "Trigger once" condition when multiple instances are involved! It doesn't work per instance, as long as one enemy has state=1, this condition will not be triggered for other enemies. If I had to name one thing in Construct that causes most problems and bugs when used incorrectly, it would be "Trigger once" condition :)

    Instead, add more states, for example: got LoS, set state=1; started timer, set state=2; started burst, set state=3 etc.

    But personally I don't like state machine events that are running on every tick. I prefer to do this with functions and "For each" loops, you have a much better control over it:

    "For each" are important, because LoS and Timer may be triggered in one tick for multiple enemy instances.

  • Like I said, using viewportRight/viewportBottom expressions fixes the issue.

    dropbox.com/s/zvvdc7dt5nxy7wf/ScrollRTS.c3p

    Только я не знаю, как они называются в русской версии :)

  • "Pick all" is left from previous version, it's not needed here, you can remove it.

    "For each chooser order by random(1)" is to pick two random chooser sprites (excluding the one we removed in event 5). It doesn't matter what number you put in random() expression in this case, it's just used to sort the list of instances randomly. Then "loopindex=1" condition is used to stop the loop after two chooser instances are processed. Again, this is not really needed, the loop can continue for the remaining chooser sprites, but Dino sprites will not be changed after that.

    random() doesn't always need a range, random(1) means the same as random(0,1)

  • I think you are confusing IID and UID - they are different! Run the game in Debug Mode, find your dictionary object in the list and check them yourself.

    Also, it's a bad practice to use fixed values for UID in the code, (like in your condition Dictionary.UID=3), because when you change the project, add/remove objects, these values can change. It's recommended to use instance variables instead.

  • There are no "objects" on canvas. You can only make "On Canvas clicked" event, and inside this event figure out which part of the image on canvas was clicked, either by comparing mouse coordinates, or by reading r/g/b/a values of the pixel under mouse pointer. For example, if your circle is red and the clicked pixel is red, then you can assume that the circle was clicked.

    Another option that may work in some projects is to add invisible sprites - clones of images drawn on the canvas - and use them in events.

  • If the screen scrolls up and left, then the issue is with the WindowHeight and WindowWidth expressions. Try using ViewPortRight(L) and ViewPortBottom(L) instead, where L is the layer with zero parallax and scale rate (for example "HUD" layer). Also you can use Mouse.X(L), Mouse.X(L) instead of absolute values. And if you map is bigger than layout size, make sure to enable Unbounded Scrolling in layout properties.

    If this doesn't work, add this event, open browser console (F12), this should help you to understand the issue:

    On every tick
    ..Browser log Mouse.AbsoluteX & " " & Mouse.X("HUD") & " " & WindowWidth & " " & ViewPortRight("HUD")
    

    PS: Русский интерфейс выглядит совершенно дико. Я не ожидал, что даже системные выражения переведены на русский! :) Если постить скриншоты на этом форуме, лучше все-таки переключаться на английский интерфейс, иначе никто ничего не поймет.

  • You have enemies that are off-screen, you don't see them but your character has LoS to them.

    Run the game in Debug Mode, when this bug happens, pause the game and check all enemy instances one by one.

  • If you want to keep track of changes that happen in runtime (for example, when player opens a chest), you can't save them back to that JSON file. But you can save them into an array or dictionary and write it in Local Storage. Or simply save the entire game state using System-Save action.

  • Complicated, but not impossible.

    dropbox.com/s/9tmz47wm4b8nj89/VeryComplicatedRandom2.capx

  • Instead of conditions 5 & 6 you can change the formula to something like this:

    lerp(-0, -100, (max(abs(Enemy1.X-Player.X),400)-400)/1000)

  • You need "8Direction -> Set vector X/Y" action. How you use it depends on the game. It can be something like this:

    Player on collision with Block 
    ... Player Set vector X to (Plyer.X-Block.X)
    ... Player Set vector Y to (Plyer.Y-Block.Y)
    
  • Use FileChooser.FileNameAt(0), save it to a variable. If you need to store it between sessions, save to Local Storage.

  • This can also be done in one line of code with regex. I'm not very good with regular expressions, but this example from stackoverflow seems to work:

    if RegexSearch( FileName, "^[\w\-. ]+$", "g")<0 ...Set text "Invalid character"
    

    \w means characters [0-9 a-z A-Z _], also allowed are dash "-", dot "." and space.

  • Good guy chadorireborn has ported MoveTo addon for C3 runtime:

    construct.net/en/forum/construct-3/plugin-sdk-10/construct-3-runtime-a-few-cons-137539

    But you are right, some effects can be very slow on mobile, even in C3 runtime. If you have many instances or objects with the same effect it's better to put them all on the same layer and apply effect to the layer.

    In my game I added an event that disables effect when FPS drops below certain number...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use find(string, substring) expression. It returns -1 if the substring was not found and a number >=0 if it was found.

    So you can add several conditions like this:

    find(filename,"/")<0
    find(filename,"\")<0
    find(filename,"?")<0
    find(filename,"*")<0
    .....Set text "File name is valid"
    Else
    .....Set text "Invalid character!"