Geoffroymonde's Forum Posts

  • How many cases are you trying to handle? All of them?

    Yes... And I feel that's a dumb way to go XD

    I need to rethink the actual cases I'll encounter instead of coding for every wall layout possible. Anyway you helped a greal deal, as I'm now able to define a precise layout and identify it. I'll go over the other examples you provide to check if that's a more suitable way to go.

  • Thanks a lot!

    It does work with your example, now!

    I'm still having problems with a lot of edge cases where the tile count creates uncertainty about the kind of tile that is supposed to be picked (in particular with cases where the overlap occurs with walls that are located in a diagonal in regards to the tile)... It would be great to have a way to add a "negative" condition (like specifying "there's also no wall in that position"), but it also looks like it's the wrong way to look at the problem, as it will create even more particular cases to describe and think of...

  • Well, as I feared, as I went along, it started to break. It looked to work so much at first XD I'm pretty sure I'm not using the Pick all correctly...

    + System: For each tile_ground

    // WALL_UP RIGHT

    ----+ tile_ground: Is overlapping tile_wall

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y-tile_ground.Width

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_up on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_UP"

    --------+ tile_wall: X = tile_ground.X-tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y-tile_ground.Width

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_corner_up_left on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_ANGLE_UP_LEFT"

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y-tile_ground.Width

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X-tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_up_left on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_CORNER_UP_LEFT"

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y-tile_ground.Width

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X+tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_up_right on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_CORNER_UP_RIGHT"

    --------+ tile_wall: X = tile_ground.X-tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y+tile_ground.Width

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_down_left on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_CORNER_DOWN_LEFT"

    --------+ tile_wall: X = tile_ground.X+tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X-tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_corridor_horizontal on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_CORRIDOR_HORIZONTAL"

    --------+ tile_wall: X = tile_ground.X+tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X-tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y+tile_ground.Width

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_deadend_down on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_DEADEND_DOWN"

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y+tile_ground.Width

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X

    --------+ tile_wall: Y = tile_ground.Y-tile_ground.Width

    --------+ System: Pick all tile_wall

    --------+ tile_wall: X = tile_ground.X+tile_ground.Width

    --------+ tile_wall: Y = tile_ground.Y

    ------------+ System: Trigger once

    -------------> tile_ground: Spawn test_target_deadend_right on layer tile_ground.LayerName (image point 0, create hierarchy: False, template: "")

    -------------> tile_ground: Set tile_type to "WALL_DEADEND_RIGHT"

  • Ok, I managed to do that! But I'm not sure it'll be robust enough for all the cases; do you think I will encounter impossible or contradictory cases? I already noticed putting the block with only 4 coordinates above the one with three yielded different results, so I'm afraid the whole thing will be even more complex to handle once I code for all the possibilities...

  • Oh, sorry, I realize my own code was mistaken (the two conditions were the same) ; I corrected this and added an actual case of a tile with only two walls on its sides.

    In this form, it does not do anything (no tile highlighted) :

    But in this form (without the picked.count condition), it does highlight the two tiles that have a wall on their side:

    How could I now differentiate between those two tiles picked ? As the player should not behave the same in both cases.

  • I'm sorry, I can't make it to work...

    Doesn't "picked count=1" prevent the conditions to pick another tile?

    Or maybe these precise conditions simply aim to no tile in my grid example and that's where the problem lays?

    Also, I was (finally) making it work with your system, but I don't know how to make the code differentiate beetween those two layouts of walls :

    As you can see, the two tiles with a red cross should behave the same to a player coming onto them: corner of a room, with walls up and left - there will even be cases where the corner is made of just those two walls, without the one in the upper-left diagonal.

    But when coding with the picked count condition, those two tiles won't have the same count (to illustrate this, I marked the walls overlapping those tiles with dots, of a different colour for each tile). Ideally, the code should just get that we have a corner in this direction, without care for the number of walls around this particular corner. I think those cornered tiles should be defined by the fact they have two walls around them, in one of their corner, and not care wether there are any other walls along the walls that form the corner... Not sure if I'm being understandable here...

  • Oh my god, this works!! Thank you so much!!

    With your (very simple!!) idea I managed to pick those damn tiles!

    I'm still not sure I understand the "Pick all wall" suggestion you follow up with (I tried it and no tile would be highlighted, but maybe I did it wrong)...

    In any case you're right, it's good if I'm able to categorize tiles by the number of walls they're surrounded with. I guess with your primary system I should be able to create a category for every ground tile's situation.

    Thank you so much for your time!

  • Ah, thanks a lot for that!

    You seem to have a better handle on my problem, yes.

    I would have never used a "pick all" condition in my case, lol, I'm not even sure I understand how it works. But this approach looks a lot cleaner than mine anyway.

    Here's how it looks on my end:

    The problem is, I want to be able to target this tile (which only has a wall on its north-east side, and no other wall around), but I can't figure how to do it..

    I tried creating a condition where it ignores ground_tiles that have a wall directly under and above them, but I think I don't understand the way Pick All works. It seems counter intuitive to reset the first pick condition... And moreover, as I said, I don't know how to alter your example to achieve the picking I need.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, unfortunately, it does not... This is the result:

    To explain further my system : I'm using 8 image points on the wall sprite that go in 8 directions of the square (north, north east, east, etc.), and pick ground tiles that "overlap" with those points. Hence the distance expression, picking the closest ground tiles to the wall tiles' image points.

  • So I have these two conditions, that pick different tiles relative to their position to the "wall" tiles (blue). As you can see, one picks every tile that is located to the bottom left of a wall tile (in a diagonal) ; and another picks every tile that is located above a wall tile.

    But for the life of me, I can't seem to be able to combine the two in order to only pick the tiles that are bottom left of a wall but none that are above a wall.

    When choosing "not equal" to the second condition, nothing happens. What am I missing here??

    Thanks in advance!!

  • Wow, thanks a lot for those two projects !

    It works very fine (even though I must admit I have a hard time understanding everything in the code, I think I managed to get a grasp of it), and I love how it follows every tile very precisely, but it might be limited in my usecase. I'll elaborate further, as I really appreciate how simple the code is and I hope I can achieve the same simplicity for my needs.

    First, I should have stated I'm actually not using the tilemap system in this project. I realize saying this was a "tile-based" game was silly of me, as itseems to imply the project is using tilemaps.

    I'll actually use sprites, because of animation needs, and also because monsters and other type of objects will have the same effect as walls on the player (rebounds, etc.) - plus other behaviours (pathfinding, etc.); from my understanding, this is not possible with tilemaps. For these reasons, I'm trying to achieve this rebound behaviour without using tilemaps.

    I tried playing with the bullet behaviour or 8directions, but it does not seem to be the right way to go about it. Notably because I need to have a "preview" of the movement before validating ; something similar to what one can find in golf games, where a dotted line is drawn from the ball and emulates every rebound the ball will make on obstacles in its way (ironically, no construct tutorial I could find about golf games had this feature). I'll need to display a similar preview, with every tile to-be-crossed numbered (to use the picture I shared in my first post, imagine every tile crossed would be numbered from 1 to 6, indicating to the player what path it will go, what rebound will be executed, and where it will end).

    For now, I managed to have a system where I can calculate on which tile the player will end in every 8 directions, but without any rebound ; meaning it will only move until it reaches a wall (I'm using those big purple lines you can see in the image to achieve this, but I feel it's not the right way to go about this).

  • Hi everyone! How would you go about creating a rebound behavior in a tile-based game? Meaning my character could be sent in 8 directions with a press of a button, will always move on the tiles (like a chess piece), and also rebound on obstacles (wall tiles for examples).

    Here is an example of a move I'd like to make possible with those constraints :

    My character is "launched" in a upper-left diagonal, with a force of 6. Meaning it will move on 6 tiles before stopping. So as you can see with the yellow line, it will rebound on vertical and horizontal walls, and also on the final angle (where the rebound just pushes it back on the same tile, maybe that's not a correct behaviour, but it's not important for now).

    I'd like to have an acceleration and deceleration behaviour too. Also, the character will damage any enemy encountered (and rebound off of them, too).

    For now, I'm using a moveto behaviour and I kind of succeeded to make the character go in the right directions ; but it seems the rebound thing can be done in a loooot of different ways (bullet behaviour ? Calculate angles ? Calculate beforehand the number of tiles to be travelled ? etc.) and I was wondering if any of you had a good idea of the best way to proceed.

  • You can use SVG in HTML Elements to made this curved text input.

    Here is an example: Curved_Text_Input.c3p

    Hi ! Would it be possible to get the project file for your example again ? Thanks a lot in advance !

  • Thank you all for your inputs !

  • Hello everyone, I'm having a problem for some time now, and havent find the solution yet.

    In my game, the player can write notes on his hand (it's a sprite of a hand). I setup something with textinput, making the textinput box invisible with CSS, and the letters appearing on the hand correctly. I'm not using a spriteFont for now (as I'm not sure it would suffice to solve all my issues). However, this method poses a few problems that I'd like to solve :

    1 - No cursor visible : It would be great to have a cursor visible, for the player to know where/when to type. I understand that's doable with sprite font (there's a great tutorial for a blinking cursor)

    2 - New line : Pressing enter should make a new line ; "append" doesnt suffice, as it only creates line break at the end of the whole text block, and not wherever the cursor is.

    3 - No Highlighting Using selecting functions like "select all" (ctrl+a) makes the invisible text (in the invisible input box) be visible through selection. The letters typed on the hand appear selected (highlighted) in the inputbox. Keep in mind I can't set it out of the layout, as the textinput function can't work like that.

    Do you think it'd be possible to create something with those 3 criterias ?

    Thanks a lot for any pointers/advice !

    Here's an example of problem number 3 (check the highlighted text in the top left corner) :