dop2000's Forum Posts

  • Thanks for the capx. So what's happening is when at least 1 enemy has line of sight, "Else" event is not executed for other enemies, which don't have LOS.

    You need to change your event to this:

  • If you are talking about the project size or performance, then no, adding Browser object doesn't affect that.

  • [quote:3w4z38dp]So when the enemy loses line of sight and doesn't have sight to anything else it should follow the ELSE code and set SeesEnemy to 0 along with EnemyX to 0 and EnemyY to 0, and then find path to its target (didnt screenshot that part)

    The error could be in that part. Could you share the screenshot of all events related to line of sight and pathfinding?

  • If by "using code" you mean "using events", then this works:

    Button Set Text to "?"

    If you meant "by numeric code of a character", add Browser object and try this:

    Variable charCode=981
    Button Set Text to Browser.ExecJS("String.fromCharCode("& charCode &")") 
    [/code:1qkt1a7i]
  • Not exactly...

    Your variable DistanceSoundBomb changes from 0 (complete silence) to 1 (full volume).

    If distance between objects is 1000 pixels or more, then it will be 0.

    You can change "1000" in that formula to 50 or whatever number you want.

    For playing/stopping sound you should use these events:

    System->Compare two values -> distance(detector.x, detector.y, bomb.x, bomb.y) is less than 50 -> Play sound

    System->Compare two values -> distance(detector.x, detector.y, bomb.x, bomb.y) is greater than 60 -> Stop sound

  • Ok, and where will you get the data to put into these arrays?

    You need to read this data from somewhere - a text file with JSON strings, or CSV file, or XML, or maybe request it from a server etc.

    I would probably use CSV - you can create a table with all values in Excel, save as CSV and import to C2. You can do the same with the lists of categories/animations.

    Also, you should probably re-think the whole idea of how you store all these pictures.

    10 animations with lots of frames, different values for each frame, plus all of them divided into categories - this mess will be very difficult to manage.

    Maybe instead of animation and frames, consider importing all images as files into your project.

    So you'll have a bunch of files (001.jpg - 199.jpg for example) and two empty sprites.

    In your CSV file you'll have the list of all images (001 - 199), list of categories for each image, points value for each image:

      001, Animals, Birds, , 7 002, People, Professions, Celebrities , 12 etc.

    Load data from CSV into an array or dictionary. When user selects a category, find a random image in the array from this category, load its picture into your sprite using this action:

    Sprite1 load image from URL "123.jpg"

    Check tutorials, I think I seen something similar there, some picture quiz game.

    https://www.scirra.com/tutorials/all

    As for the repetition issue, you can simply delete images from the array after they have been used.

  • Check out SpriteFont, I think it should suit your task.

    I recommend SpriteFont+ plugin (slightly better than the official SpriteFont) and SpriteFontGenerator tool, you can create beautiful and unique fonts for your games.

    SpriteFont object behaves like sprite, you can resize it, fade, rotate, add behaviors, effects, pin to other sprites (flowers) etc.

  • Sure, you can start audio playback on collision with some sprite.

    Or compare distance(character.x, character.y, gold.x, gold.y)

    Say, if distance <500, start audio.

    If distance >600, stop audio.

  • msha91

    Oddly, I'm only getting this error in Chrome, in other browsers it works fine.

    In event 8 move "Remove all physics joints" above the "Sprite set physics disabled".

    This should fix it.

  • Thanks, Colludium !

    I'm so glad I found this post, it saved me hours of work converting all text objects to spritefonts!

    Can confirm, "Basic" option fixes the problem with Cyrillic characters.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are doing something wrong, probably picking wrong set of enemy instances.

    If you change your code to something like this:

    Enemy is overlapping DetectionSprite -> Enemy set speed to 100

    else -> Enemy set speed to 10

    then only enemies overlapping DetectionSprite will get speed increase.

    You can do the same without the sprite. For example:

    System: Every 1 seconds
    System: For each Enemy
        System: Compare two values: distance(Enemy.x, Enemy.y, Player.x, Player.y)<200 -> Enemy set speed to 100
        Else -> Enemy set speed to 10
    [/code:26nq1shi]
  • I'm not sure how positioned audio works, I thought it adjusts the volume for left and right channels (for stereo effect). But I might be wrong.

    Anyway, here is an example of how you can change volume depending on the distance between two objects:

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

  • [quote:1zukx38c]3. When player selects a category, you can choose a random animation from a comma-separated string of animations using this expression:

    animationsList = category3 // for example

    animationName = tokenat(animationsList, floor(random(tokencount(animationsList, ","))), ",")

    Is this animation list will be filled by the string variable "category3" and the tokencount will be separate this information and randomize them? Is that correct?

    animationsList is a text variable, you can fill it from Category3 variable or in the future from your DB.

    That long formula selects a random animation name from a list of names separated by commas. See tokenat() and tokencount() expressions in the manual.

    [quote:1zukx38c]

    Simple points. For example: frame 1 worth 3 points, frame 2 worth 1 point, 3 worth 7 points...

    Ok, but you will have at least 100-200 different frames. How your game will know how much points each frame worth? Where will you get this information from?

  • Fixed:

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

    But do you really need physics? If the "rope" is rigid and the object is not interacting with other physics objects, then this kind of movement can be done without physics behavior:

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

  • Nice demo, Bruno!

    I added drag&drop:

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

    It works, however the dragging distance and speed needs to be limited, otherwise the chain can break.

    I wonder if it's possible to make an unbreakable chain?

    msha91

    I see that's not exactly what you wanted. Oh, well..