AlkamlBan's Forum Posts

  • 12 posts
  • Basically what I am trying to do is have a sprite move to a position using pathfinding but I need it to move on a grid (the grid is made using a tilemap with the cell size for the pathfinding being the same as the tile size so no problems there). What is troubling me though is that upon clicking to move the sprite it doesn't move until I click once more eg I want to go a position I need to click twice for the object to find and start moving along the path. At first I thought it was the pathfinding that was a bit slow but afteresting it by double clicking with different time delays between the clicks that was not the case aka if I clicked fast then the object moved as soon as the second click took place but if I clicked slow then the object wouldn't move until I clicked the second time. And it wasn't the first time either. Every time I want the object to move I have to click twice.

    On top of that I noticed that the pthfinding doesn't find the fastest route to the destination. Since I want the object to move in a grid I set the Diagonal movement to False which works as intended but when the object moves to a new position it just follows a straight path followed by a 90 degree turn and then another straight path to the target area (no obstacles to move around in the layout). The problem is that instead of following the closest path aka a pseudo-diagonal movement made up of multiple 90 degree turns it follows a much bigger path.

    Is there an option to change these or do I have to code that my self?

  • Simple question: I want to have my tilemap tiles change size while playing is there a way to do that or do I have to set a fixed size before hand?

  • >

    > Just disable the object, so it can not switch to 'in focus'.

    >

    As i told you.

    Set the property 'enabled' (in the layout) to 'no'.

    After the full creation sequence (including scaling), use the action .. TextBox > Set enabled.

    If you going to draw boxes on top on each other, then use my example.

    So I replaced the "Set unfocused" with "Set enabled" -> "Disable" and it still has that effect where some times it works and others it doesn't. I tried it with both and still same result. It seems to me that the "On Button Released" part sometimes doesn't get activated when I release as not only does it not get disbled but neither unfocused. Problem is I have no idea why. As for your code I don't know if it works on the 245 stable release since I had to download another release to open it.

  • Based on the first selfie, this is what you try, or very close to.

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

    The second selfie makes no sense to me.

    About the While loop. The events run in a loop already. Use any other loop only if you want an iteration to happen inside 1 tick. If you update graphics in a loop, and therefor inside the time of 1 tick, you will never see them updating, besides there where the loop ended, because the drawing happens at the end of every tick. Hence the term 'Frame Depended'.

    About the 'and never lets go'. The text-box that you draw is 'in focus'. Meaning, it is stealing the mouse. A text-box is a form element. It does not live inside the canvas. It lives on top of the canvas in its own world. Basically canvas and form elements are different windows. If you have two windows on your desktop, the one that is in focus is getting keyboard and mouse changes. The other dont.

    Just disable the object, so it can not switch to 'in focus'.

    Ok so after a bit of time of rework after rework I made this which...half works. It works perfectly sometimes other times the textbox doesn't leave focus so if a mistake of some sort could be pinpointed that would be appreciated.

    Img: https://drive.google.com/file/d/0Bxfvxf ... sp=sharing

    I personally think its the "On button released" part but I don't know of a way around it.

  • It is Mouse.X - posX and Mouse.Y - posY. TextBox cant have a negative size.

    But i dont see a simple way to reset the Boolean in that flow.

    'On Button CLICKED' will steal a 'On Mouse button released'.

    Ok so I re-wrote part of the code because I forgot to save <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes"> and it now looks like this :

    https://drive.google.com/file/d/0Bxfvxf ... sp=sharing

    When I run the code and click the button the cursor changes correctly. After that I click and drag but from what I understand an infinite loop takes place and everything just lags and firefox crashes. If I moved the actions from the While statement to the disabled (to the Is Checked sub-event) then the textbox appears where I want it to and scales depending on the mouses position just like intended but even if I let go of the mouse button it still scales with it and never lets go.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you can import the cursor object then have every tick set cursor to none then have another sprite pinned to cursor.X

    and cursor .Y and have that on an every tick statement

    It seems you can't set it to none and even with Every Tick instead of On start of Layout nothing happens. Luckily for me though I wanted to make it chance to the different types you normally see (hand, text select etc) so I used Set Cursor Style instead which worked with On start of layout.

  • It is Mouse.X - posX and Mouse.Y - posY. TextBox cant have a negative size.

    But i dont see a simple way to reset the Boolean in that flow.

    'On Button CLICKED' will steal a 'On Mouse button released'.

    So I should use a On Button Pressed on both? I tried that and it still didn't work but I will try it again to be 100% certain.

  • Yes you can its easy to do so.

    on start of layout -> Mouse -> set cursor from sprite.

    I did that and it didn't work. Even when I start the layout the cursor remains the same

  • I want to make a game in which the ccursor will be able to take any form I like. I can do that by having a sprite be at the mouse's position every tick but is there a way to make the normal cursor disappear, or better yet change it with the sprite one?

  • I am trying to make a simple feature. The idea is you click a button and then you click and drag the mouse to create a box to type in, just like in any image editing software. I have currently made this: https://drive.google.com/file/d/0Bxfvxf ... sp=sharing (didn't know how else to put the image)

    Once I run the code everything looks fine. I click the button the sprite follows the mouse but after I click and drag the box doesn't appear (and yes I have forgotten to set it to visible but I did that while writting this and it still didn't work). So how do I do it?

  • I don't want the player to move it but have it move on its own (player presses a button while inside and area and the sprite moves its self into the correct position) and the 8-Direction Beh. does not include an expression that would enable me to move it into position (Since the movement isn't specific I don't think I can use it)

  • I want to make a sprite move its self into a specific position once some requirements are met. The only problem is that I want the movement to be smooth (aka not use "Set position" which just causes it to jump there). I tried using Custom Movement but haven't made any progress yet .

  • 12 posts