InDWrekt's Recent Forum Activity

  • RegexReplace(Self.Text, "^0+", "", "")

    You should look into the RegexReplace function. The code written above is what you set the text to in the set text action.

    There is no need for a loop. No reason to check the string 1 character at a time. Regex simply looks for a sequence of characters that match the search criteria entered in the second parameter and replaces it with the value in the forth parameter. Of course you should also learn about regex but basically this is what it is looking for:

    ^ - This signifies that is starts at the beginning of the string. If there is a match further in the string, it won't be replaced because the match must be the first thing in the text.

    0 - This is the character the regex is looking to match.

    + - The plus sign following a number or letter says to match 1 or more instances of that character. So, in the case of leading 0s, it doesn't matter if there is 1 or 100, they match and will be replaced.

    Regex is an extremely powerful way to work with and manipulate text objects and can save both coding and processing time.

  • I do want to caution you about using really high numbers though. This program works great until you get to the 79th number in the sequence. Then the number becomes too high and, do to the nature of computers and numbers, you start to run into rounding issues. If you really do need to include the 100th number in the sequence as mentioned in your post, you are going to have to break the number into different parts (millions, thousands, hundreds, etc...).

  • Try this out:

    In the image, the "set text to Variable1" action is where you would set the variable you will be using in your game.

  • You'll get better/faster responses if you post your project here so we can take a look at what is going on.

    That being said, I have had a similar issure only on the edges of the tilemap where the tiles aren't full tiles. For example, if the tiles are 30 pixels wide and the total width of the tilemap is, 290 the far right tile will never be able to be drawn. If your problem is specifically at the edge, check to make sure your tilemap width/height is a multiple of the individual tiles width/height.

  • + Keyboard: On any key pressed

    + System: len(str(Keyboard.TypedKey)) = 1

    -> Text: Append Keyboard.TypedKey

    means

    Hopefully that helps. The whole thing is a single event. the + represents conditions and the -> represnts the action. This is how construct outputs events when copied to text.

  • drive.google.com/file/d/1yG8azZPg66Ve6QxSHzGXY6LHqg8GmBc0/view

    Take a look at this project. It should give you some ideas how to trim your code down.

    Since your conversation is linear, you don't need to write the conversation over multiple rows of the array. Instead, you could use the rows to define different characters text. You then use a local variable on the character that defines which line of text to use. You would also use a key word to define the end of a line of conversation and a different one to define the last part of the conversation.

    I added a little bonus which allows repeating multiple lines of text if wanted.

  • First question, is there a reason you can't use a text input object?

    Second try this out and see if it will work for you.

    + Keyboard: On any key pressed

    + System: len(str(Keyboard.TypedKey)) = 1

    -> Text: Append Keyboard.TypedKey

    The second condition just ensures that the text is only appended if the length of the typed key is 1.

  • Construct has some built in examples. Take a look at the Simple Lighting example in the Beginner Examples list.

  • + Sprite: Is Pathfinding moving along path

    + System: Sprite.Pathfinding.CurrentNode ≠ Sprite.Pathfinding.NodeCount

    ----+ Sprite: X > Self.Pathfinding.NodeXAt(Self.Pathfinding.CurrentNode)

    -----> Sprite: Set animation to "MoveLeft" (play from beginning)

    ----+ System: Else

    -----> Sprite: Set animation to "MoveRight" (play from beginning)

    Here's another option. This one uses the x coordinate if that is easier for you than the angle. Notice the use of the NodeXAt call. This gets the x coordinate of the node whose id you pass in.

  • Alright, try this:

    + Sprite: Is Pathfinding moving along path

    ----+ System: Sprite.Pathfinding.MovingAngle is between 90 and 270 degrees

    -----> Sprite: Set animation to "WalkLeft" (play from beginning)

    ----+ System: Else

    -----> Sprite: Set animation to "WalkRight" (play from beginning)

    Instead of checking the x value, check the move angle. If it is between 90 and 270, the player is facing left. if not, the player is moving right.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Y coordinate represents up and down. Try using the X coordinate.

  • xeed what are you trying to accomplish? Maybe you could give us a little more information so we know how to help you.

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