santiagoestrade's Recent Forum Activity

  • Ok, there's no slow down with variables. I am working with approximately 20 or 30 instances of the same sprite, yet, as you say, just calculating when a 'chess' moves. They'd rather have instance variables for each one? I am no used at all with playing with instances and their behaviour. Every piece of help is most welcome

  • It was actually a matter of a really noob trying to do things without proper knowledge haha.

    I have read the manual on construct.net, yet couldn't find that comprehensive section on expressions. That's exactly what I needed. I really appreciate it.

  • dop2000

    Now I have it already simplified. It will be played on mobile and I want the arrow to show up just when touching and then freeze, so changed the every tick condition with On tap on tilemap. Removed variables and everything seems to work fine. Thanks so much!!!

    1drv.ms/u/s!AojCIgmN1VlPiWjfQMhXp4MCGcdS

  • Ok, that way I didn't know could be done. Impressive! Really simpler than my take.

    Just two doubts:

    -you set arrowline position manually (10,4). I suppose it's given as example. I figure out it would be troopX, troopY. Also the arrow being onto a lower layer, in order to avoid eclipsing the troop sprite on the screen.

    -isn't it possible to make it without the local variables? I mean- skeeping the system action and begining with the arrowline. The trigger would be On Touch/click on Tilemap.

    -arrow set position to (Troop.X, Troop.Y)

    -arrow set angle toward (Tilemap.SnapX(Mouse.X), (Tilemap.SnapY(Mouse.Y))

    -arrow set width to distance (Self.X, Self.Y, (Tilemap.SnapX(Mouse.X), (Tilemap.SnapY(Mouse.Y))

    Is that possible? Or it might not allow the tilemap.snap expression inside distance?

    It's just because I prefer to stick to fewer actions/objects/variables. I think (correct me if I'm wrong, I actually have no such knowledge) having to update and retrieve variables could lower performance because of loading/saving data into memory, compared to a seemingly big but simple formula, which CPU calculates lightning fast. And actions go one by one, so even though hardly noticeable, it will always be slower because every action has to wait for the previous one to be fulfilled before starting their own.

    Anyway, trully grateful for the help! That was just what I was looking for. I didn't know about distance parameters... that eases the thing a whole bunch. Also the Snap expression for the tilemap is awsome. I was walking on circles with positiontotile<>tiletoposition hahaha.

  • I am developing a strategy board war game. When I click a troop sprite and then click on the map, it should set the animation frame depending on the distance to travel. For instance, if I click 3 tiles away, it should show an arrow which length covers 3 tiles. If clicked on a neighbour tile, just 1 tile size arrow. In the arrow sprite, first frame shows 1 tile arrow, second frame, 2 tiles arrow. And so on.

    The events for that are quite simple. The issue is I want to keep things proportional, so into the parameters dialog for the frame to show up, I want to calculate the distance in tiles between the target tile and the one the troop is onto.

    To achieve that, I use Pithagoras theorem. Both sides of the triangle are Touch.X-Troop.X and Touch.Y-Troop.Y.

    So, distance = hypotenuse, thus:

    (√ ( (Touch.X - Troop.X)² + (Touch.Y - Troop.Y)²))/"tile size"

    The formula above is not accurate enough, for it calculates from where I touch, not the center of the tile, where the troop will land. Yet not by mistake. Just for sake of simplicity. It would be Tilemap.TileToPositionX(Tilemap.PositionToTileX(Touch.X)) instead of just Touch.X. Troop needn't recalculating, because it will always be at the center of the tile, due to the previous movement having already calculated that.

    So, the entire formula looks like this:

    (√ ( Tilemap.TileToPositionX(Tilemap.PositionToTileX(Touch.X)) - Jugador.X)² + (Tilemap.TileToPositionX(Tilemap.PositionToTileX(Touch.X)) - Jugador.Y)²))/64

    That should be into the parameter box for the value of the frame to be called. That way, 1 tile away calls 1st frame, which is 1 tile arrow,...

    But I am having a hard time writing down the expression, for I have no experience on programming. The trouble is not finding the right expressions, but the right syntax. Maybe I am missing some symbol or adding some other that shouldn't be there.

  • Thanks!! Didn't know Chardori had ported that addon.

    I was emulating it with set angle and set position, but I wanted a smoother movement.

    I was thinking of emulating it with trigonometrics. Using Pythagoras to calculate distance to travel until arriving where I click/press onto. Therefore, it could be achieved with 'Move Forward' action.

    Since I can calculate X vector (TouchX - SpriteX) and Y vector (TouchY - SpriteY), distance is equal to the hypotenuse of the triangle whose other sides are VectorX & VectorY.

    So:

    distance = square root of ( (TouchX - SpriteX)^2 + (TouchY - SpriteY)^2 )

    Anyway, I'll try the addon either.

    Edited: some other pal told me about distancr parameters, which (fool of me for thinking IT people wouldn't have alrrady thought about it) allows to type coordinates for both objetcs, so problem solved. No need for trigonometry. Just a lot more forum/tutorial reading.

    tarek2

    Already voted!!! I love this thing of suggesting new features. I'll take a look to see which interesting ideas are around.

  • You're right. I thought stable R120 had already C3 as default runtime. Turns out I was wrong. Bye to every Rex plugin... I'm going to miss MoveTo.

  • Is there any issue with the new beta releases? When launching them, almost every non built-in plugin is not available to insert. If I go back to the stable release, they are available. But not with R123 nor 123.2. I don't know whether is a matter of compatibility bug or is made on purpose for future releases? Maybe I should reinstall those plugins after updating to the beta?

  • It's been a while since nobody talked here, but I have a similar issue. Trying not to fill the forum with duplicated topics.

    I am developing a strategy board war game, Civilization/AoE like. The board is a tilemap.

    You select which troop to move by pressing/clicking on the instance and then dragging/clicking/pressing on the destination tile.

    After you have selected the active troop, I would like an arrow to be shown from the troop towards the destination tile. So, if you get further from the troop, the arrow lengthens.

    I have read people doing similar thing by changing the animation, yet that would require having, let's say 10 differents sprites, each one a tile longer, just for that. Is it not possible to call a specific frame of the animation according to position? Being that the case, I could just have an arrow sprite, being each frame an arrow a tile longer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, then I'll just discard the tile by tile animation. No worries about that. Just a visual floriture. I'll stick to press/click on instance and then press/click on target tile.

    I just have a doubt about tile movement to see whether it can be useful for this project. When calculating the grid for the movement, does it takes the position of the instance and from there, it 'counts' grids according to the size you set? Or it virtually divides the layout in a grid and then calculates to which tile belongs the position of the instance? I don't know if I am succeding at explaining myself.

    Already a bit confused about the possible usages with tile movement and tilemap. I know you can have tile movement effect with this plugin without using tilemap. But, since tilemap allows for several movement/positions options (move to # tile, to neighbour, positiontotile,...), I think I don't need tile movement plugin either if I already have a tilemap. Or do I? I asked for documentation because there may be some conditions/actions/expressions which suit better my game than the ones that tilemap offers. If moved more/less than # tiles, if moved in a certain direction,... and things alike.

  • Ok here we go!! Thanks very much. Smartphone didn't allow me to press and drag to select several tiles alltogether either. It showed the typical menu for copying, pasting... Now I have the map done.

    Is there already some documentation for the tile movement plugin? I am try to use it with drag&drop, but at the time of draging, the movement is smooth, not 'tiled'. I thought working around it on the event sheet.

    Something like: On drop > save position, then move troop instance to origin position, then move to loaded position. So to speak...

    Anyway, it's quite unelegant and even whrn dragging, the troop instance keeps moving smoothly as your finger slides over the screen. I would like to see the instance moves tile by tile even at the very moment of dragging. Is it posible?

  • Oh god, that was it. It's me using my smartphone, instead of the PC. When you open the tilemap tab, the layout is not on the screen, so I never though it that way- clicking in the tab, then onto the layout. I am starting to work on PC for preventing this sort of misunderstanding.

    Moreover, I didn't quite understand the purpose of the tileset at all. Now I do. You load every different tile grouped in the tileset and then pick which tiles go where. I am no native english speaker, so some words don't ring my bell as they should. Being tileset what you edit in the tab, not tilemap, now it seems so obvious.

    Sorry for the loss of time, but again thanks a lot for you have gave me some hints of how to work around it. Lots of tutorials to read, now that I can move on.

    Not sure if I am asking nonsense again but- tiled background loops the same sprite. Tilemap lets you assign certain sprites (tiles actually, but for the sake of analogy). Is there a way of loading a picture, as per the tileset, and move every tile to the layout in the same order they are in the loaded picture? It would be the same as when you set up the grid onto the layout in the properties bar. But locking that grid to make it visible in prev and game. If you take a look at my map, there are to be several tiles and I want the layout to look exactly like my map, just with a grid.

santiagoestrade's avatar

santiagoestrade

Member since 25 Mar, 2016

None one is following santiagoestrade yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies