dop2000's Forum Posts

  • I still think you are wrong.

    You are basically asking to implement a hack.

    I can see how this feature can be useful in some projects, but I also see how many people (especially beginners) will abuse it and this will result in very poor code organization, and could potentially cause more harm than good.

  • There is a number of expressions you can use to convert from layout coordinates to tilemap x,y:

    PositionToTileX(x)

    PositionToTileY(y)

    Convert an X or Y layout co-ordinate in to the corresponding tile number in the tilemap. For example, this can be used to get the tile position under the mouse.

    SnapX(x)

    SnapY(y)

    Snap an X or Y layout co-ordinate to the nearest tile. This also returns a layout co-ordinate, but aligned to the nearest tile in the tilemap.

    TileAt(x, y)

    Return the tile ID at a position in the tilemap. Note the position is given in tiles, not layout co-ordinates. If the tile at the given position is empty (has been erased), the expression returns -1.

    TileToPositionX(x)

    TileToPositionY(y)

    Convert a tile position to layout co-ordinates. For example, this can be used to position a Sprite object on top of a given tile.

    .

    So you can get tile number that player is on using this formula:

    tilesMap.TileAt(tilesMap.PositionToTileX(player.X), tilesMap.PositionToTileY(player.Y))

    You can check 4 points at some offset from the player to prevent it from stepping into water etc.

    .

    Creating a separate invisible solid tilemap for collision detection is actually a very good and popular solution. It will not make your project file any larger, because you only need one tile (just a black square).

    You can auto-generate this collision tilemap based on tiles on your main tilemap. Just loop through all x,y tiles on your main tilemap and set or erase corresponding tiles on the collision tilemap.

    When your player is in "walking" mode, erase entire collision tilemap and then set tiles with water, trees, mountains etc. When your player is in "boat" mode, set tiles for the entire collision tilemap, and then erase water tiles.

  • Oh, I see it now, thanks!

  • Could be anything - collisions disabled, event not getting executed (because it's part of some other triggered event for example), or maybe there are other events that override or stop playback of this audio.

    Could you share your project file?

  • Save slots are for saving the entire game. In your case you need to use Local Storage.

    When a new item is unlocked, add its code (or ID or name) to an array (or dictionary) "UnlockedItems", and save it to local storage.

    On start of the game, retrieve this array from local storage.

    .

    Here is a demo I made for some other post:

    dropbox.com/s/1cz1k5x3teikbv5/DictionaryLocalStorage.capx

  • Lancifer I still see "0 comments" in my profile, and there is no "Posts" link anywhere..

  • Have you read this tutorial?

    scirra.com/tutorials/73/supporting-multiple-screen-sizes

    Also, try changing "Unbounded scrolling" in layout properties.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using "Wait" like this is a bad idea. Timer is a much better option, but you still need to keep pending achievement IDs somewhere.

    .

    You can try a different approach - create an array or dictionary named PendingAchievements.

    When a new achievement is unlocked, add it to this array.

    Every 1 second or so check this array, if it's not empty and AchDisplay=false, display first achievement from the array and remove it.

  • Thank you, I would be honored!

    If you need my real name, there is a facebook link in my profile :)

  • Hey, no problem! :)

  • You don't need to use containers, they just make life easier :)

    And yes, you should only add objects that live and die together. So that wearable sprite should not be in the container.

    One container can hold only one instance of each object. So you can't add CarBody and 4x instances of CarWheel into the container, it will not work.

    Very common example is to add an enemy sprite and health bar to the same container. You don't need to worry about creating/destroying the health bar, nor about picking it. You can make simple events like On bullet hit enemy -> Enemy subtract 5 from health, HealthBar set width to Enemy.Health (this enemy's HealthBar will be picked automatically)

  • Try opening browser console (F12), maybe you'll see the error message there.

  • There may be a better way to do this, but the search on the forum is broken, so I came up with this:

    dropbox.com/s/lbewjvv6rekd2na/IsometricForest.capx

  • So you have one Question sprite with animations A,B,C,D etc.

    And many Answer sprites also with animations A,B,C,D etc.

    When you spawn Answer sprites, you set random animation and random frame like this:

    Answer set animation to Choose("A", "B", "C", "D"...)
    Answer set frame to int(random(self.AnimationFrameCount))
    

    .

    Then when player clicks on the answer you check if animations match:

    Mouse On Click on Answer
     System Compare two values: Answer.AnimationName=Question.AnimationName
    

    If they match then the answer is correct.

  • rhg1968

    Collision checks are not performed if there are no events or behaviors that require them, so you don't need to disable collisions for all sprites.

    Say, if you place a hundred of sprites on the layout and run the project in debug mode, you'll see that the number of collision checks per second is zero.