InDWrekt's Recent Forum Activity

  • You do not have permission to view this post

  • Also, if you could post the error message you are getting when trying to open the project I might be able to figure out how to solve it.

  • I built the project in the current stable release (r218) of C3. Is that what you are using to try to open it? There are no plugins so there shouldn't be anything preventing you from opening it.

    Yes, I was able to open yours but I didn't really take any time examining it. I wanted a clean example so the code would be clear.

    I understand that you want the "Enemy" to move but that doesn't change anything. "Player" or "Enemy" are just semantics and the code is all the same.

  • I'm not sure if the is the BEST way to do this because I have never taken the time to build a hex-based game in Construct but since I noticed this topic has been here for a while without an answer, I figured I would try my hand at it. The attached example uses a dummy object with the path finding behavior to set the path of the red character. The hexagon object has the solid behavior but it is disabled where the player is allowed to travel. To Ensure the character can only land on empty spots, you need to enable the solid behavior of occupied spots and regenerate the obstacle map.

    Also, you will notice a bunch of disabled events/actions. If you enable them, the player movement will be restricted to a set number of moves.

    drive.google.com/file/d/1N3yvrCkc3uxw74kD5VYxARlXavN7sUqE/view

  • If you can attach your project, I can take a look at it for you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • drive.google.com/file/d/1bFw9URYwNhyfiG_TbDdZSrYoPcnlwzZX/view

    Take a look at this example. There are 2 layouts. One that has very minimal actions. All you do is click the red ball to kill it but each time it is clicked, it becomes invulnerable for 5 seconds.

    The other uses an 8 direction controlled player that will trigger the ball to be invulnerable. It also causes the ball to flash when it is invulnerable.

  • , a Boolean variable as mentioned by Maverick1912 is a good way to handle this issue but requires you to code when to disable it. I prefer to use an integer variable that stores the time to end invulnerability. When the character becomes invulnerable, you would set:

    invulnerableUntilTime = time + X seconds

    Then, when damage would be dealt to the character, you would check if:

    time > invulnerableUntilTime

    With a Boolean, you still have to set the value and check it but this completely removes the need to set the Boolean value to false. By nature of the passage of time, the invulnerability will be remove.

  • the.sand, Don't think of it as an array. Think of it as a stack. You are adding and removing actions from the stack. Only the action on top of the stack is active. The others activate as the top action is removed and the next is uncovered.

    Also, if you do take a look at the example by calminthenight, you will notice without the stack, more events and variables are required just to get 2 directions to work. To get the other 2 directions, you would have to double both the variables and events. That makes the code more difficult to work with and debug when something goes wrong. It is a fine example if you don't want to make use of the stack but, you can see the event sheet can very quickly become hard to follow.

  • calminthenight The built in movement controls don't allow for overriding one direction when another is pressed in the way the OP describes. If you try it you will see, that up and down will override left and right but left and right won't override up and down. Also, opposing directions cancel each other out. The OP wants the most recent pressed directional key to move the character even if another key is still pressed.

  • I don't really understand the need for the individual Booleans you are defining. In every place you would use your Boolean, you can just reference if the key is down. The added Boolean value just bloats the system and makes it harder to read/debug.

    As for the question about keeping track of what is the last key pressed, you could implement a stack which stores key press information and check the last key on the stack when trying to move. See the attached example. The stack is built using an array and when an arrow key is pressed, the direction is added to the front of the stack. When the key is released, the direction is removed. Then, to determine the direction the player will move, the front item is checked.

    If you really do need the Boolean values, just replace the "is down" conditions with your Booleans.

    drive.google.com/file/d/1unE5jG0C7lq8iU_Lrji5ltvD616Wq9H-/view

  • drive.google.com/file/d/11KwhVVbjS2fB_KaTPDuKY-CLArBW6Wf6/view

    Hopefully this example gets you what you need. Just click the card and it will flip over.

  • I don't have an answer to solve your problem but I do think you uncovered a bug. See the 2 attached pictures.

    I debugged your project to see if I could see what was going on and this is what I found:

    I stretched the bottom left corner of the mesh to the left until it was nearly touching the left side of the screen. I then rotated it until the 2 left sides were aligned with each other. In the debugger, I took screenshots of the oleft and sprite2(0).x values.

    The first image shows the x coordinate of the Sprite2 object on the far left side which should be your sprites bboxleft value. The second image shows the the value that was stored in the oleft variable. This should be the same as the first value but they definitely aren't. I am not an expert with the mesh object but from all I can see, your events should work fine, the system is just not getting the correct bounding box values from a mesh that has been deformed and then rotated.

    I would suggest you submit this as a bug.

InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies