dop2000's Forum Posts

  • Have you tried searching this forum? There are several Google Maps addons for C2, some of them may be ported for C3.

  • Are you using any effects? Even simple effects can be very slow on mobile (at least on Android).

    There could be many other reasons why your game is slow.

    See how many collision checks are performed in debug mode. (anything under 100.000 per second should be fine).

    Check if you have any heavy events that are executed on every tick. Or maybe you are spawning too many objects and not destroying them. Also, try "Profile" tab in Debug mode.

  • Put all keys into a dictionary. Then save this dictionary in local storage.

  • You might need to use "acquire target" instead of "Add object to target".

    It's more work, but this way you have more control. So your event may look something like this:

    Every 1 second

    For each turret

    ..If turret doesn't have target

    ....Pick enemies that are in range and visible

    ......Pick nearest enemy to Turret -> Turret acquire target Enemy

  • I don't know, I'm not a psychic :)

    I have no issues running this code in NW.js

    Try pressing F12 and check console log, maybe there will be some additional information about the error. If you can't figure it out, please post the error message and a screenshot of your events or capx file.

  • No, it's one of the system expressions.

    Just copy and paste this into "TextObject Set Text" action:

    RegexReplace(str(v), "(?<=\d)(?=(\d\d\d)+(?!\d))", "g", ",")

    v is the variable with your big number.

  • Made a level with 15 bombs to see if it's possible to beat it.

    The answer is - almost :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assuming that layer 0 is not scaled, and layer 1 is scaled, Sprite is on layer 1:

    On every tick -> Sprite set position to

    X: CanvasToLayerX(1, LayerToCanvasX(0, Mouse.X, Mouse.Y), LayerToCanvasY(0, Mouse.X, Mouse.Y))

    Y: CanvasToLayerY(1, LayerToCanvasX(0, Mouse.X, Mouse.Y), LayerToCanvasY(0, Mouse.X, Mouse.Y))

    .

    EDIT 12 days later:

    AM_Games , scrap that! I just remembered that you can easily get mouse coordinates for any layer.

    Simply set position to Mouse.X("layername"), Mouse.Y("layername")

  • You can break the string into tokens and re-assemble again:

    variable newPrizes=""
    For x=0 to (tokencount(Prizes, ",")-1)
     if loopindex=4 : Set newPrizes to newPrizes & "9"
     else : Set newPrizes to newPrizes & tokenat(Prizes, loopindex, ",")
    
    
     // add comma after each token, if not the last one
     if loopindex<>(tokencount(Prizes, ",")-1) : Set newPrizes to newPrizes & ", "
    
  • You can do this with regex:

    Set v to 123456789
    MyText set text to RegexReplace(str(v), "(?<=\d)(?=(\d\d\d)+(?!\d))", "g", ",")
    

    result: 123,456,789

  • You can also try this method:

    1. Convert object coordinates from layer 1 to layer 2

    Sprite set position to
    X: CanvasToLayerX("Layer 2",LayerToCanvasX("Layer 1", sprite.X, sprite.Y) ,LayerToCanvasY("Layer 1", sprite.X, sprite.Y))
    
    Y: CanvasToLayerY("Layer 2",LayerToCanvasX("Layer 1", sprite.X, sprite.Y) ,LayerToCanvasY("Layer 1", sprite.X, sprite.Y))
    

    2. Transfer object to layer 2 and then move it towards the basket, using Bullet or some other behavior:

    Sprite move to Layer "Layer 2"
    Sprite set Bullet enabled
    Sprite set Bullet angle of motion to angle(self.x, self.y, basket.x, basket.y)
    
  • Resizing text objects dynamically is surprisingly difficult.

    You need to make the text field big enough to fit the entire text, then set text. Then wait a little for the system to render it, measure the text using TextWidth and TextHeight expressions. And only then you can resize the text object.

    It's probably better to do the rendering/measuring with a different (hidden from the player) text object. See this post for some examples:

    construct.net/forum/construct-2/how-do-i-18/creating-appropriate-sized-spe-128993

  • "On space pressed" is a triggered event (as all other events which start with "On").

    Never put triggered events nested under some other events.

    So try moving it to the top level, and add "MapWorld is ovelapping event" as a second condition.

  • Put sprite1 on layer1

    Put sprite2 on layer2. In layer2 properties set "Force own texture=Yes".

    Add mask sprite (for example big black rectangle) on layer2, above sprite1. Set "Blend mode=Destination out" on mask sprite.

    Now if you move the mask sprite to overlap sprit2, sprite2 will become invisible, revealing sprite1.