sgn15's Recent Forum Activity

  • put HUD object on a separate layer with parallax set to 0,0 and scale to 0

  • Oh, about the variable thing I suggested, use abs(player.x - object.x) for the variable. Then if you want to check if the object is to your (player's) left or right, use Compare X to check if object is at your left or right. (greater than means to your right, less than to your left)

  • What FragFather meant was to:

    replace everything inside the < > including both signs (less than and greater than) with your object

    <name of object 1>.X,

    <name of object 1>.Y

    <name of object 2>.X,

    <name of object 2>

    so it should be:

    player.x

    player.y

    object.x

    object.y

    You just misunderstood him.

  • post your expression here so we can see the syntax error

    Also, if you only want the horizontal distance, you can use a distance variable that saves the difference of player.x and object.x then use that variable to check if the distance is within that value you want

  • I advice setting some variables to check your X and Y distance first (between player and tiger). Then check using compare X and compare Y if the tiger is at your (player) left or right

    Well, I was going to type a long one but I already did here

    https://www.scirra.com/tutorials/1320/p ... enemies-ai

    Basically use compare X, compare Y and the X and Y distance variables to determine if it will run left, run right, or attack (when near you)

    Go have a read at it. It has capx.

  • Assuming the score is in a variable, you can use some basic math to keep adding X while the number in text is not equal to score

    X is any small number that you can get by different formulas, but I would suggest making the value of X proportional to the score, so it will work as ratio (even if score is lower than 10 or even as high as millions). Use division to get X value.

    I hope you understood my explanation. I'm not good at explaining.

    text number < score

    -->add X to score

    Just replace X with your expression

    You have to use another variable probably for the text number because you want to add to it instead of showing the score at all times.

    Edit: use the new variable like this.

    Every tick

    -> Set text to text number variable

    text number variable is separate variable from score.

    Also, add another event to set text number variable to score if it exceeds score (after increasing by X) just to make sure it is consistent with the real score

  • IndieKiwi

    Sorry I went out earlier. I'm back to working on this.

    RegexMatchAt(WebStorage.LocalValue("GameSave"& ,"GameSave\d(\d)", "",1))

    ^is this corrrect for X?

    I got confused with all those commas and parentheses.

    and this for Y

    RegexMatchAt(WebStorage.LocalValue("GameSave"& ,"GameSave(\d)\d", "",1))

    this for whole expression of value?

    WebStorage.LocalValue("GameSave"& RegexMatchAt(WebStorage.LocalValue("GameSave"& ,"GameSave\d(\d)", "",1)) & RegexMatchAt(WebStorage.LocalValue("GameSave"& ,"GameSave(\d)\d", "",1)))

    blue for X

    red for Y

    is the expression correct?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • IndieKiwi

    Thanks. I'll thoroughly read and study it later. Favorited and bookmarked!

    so is \d is only for matching single digit numbers?

    If you remember me and my previous problem (which you also helped me), my problem was saving the number from Animation names with names like Animation1, Animation2, and so on into instance variables.

    So will \d save 1 or 10 from "Animation10" ? I haven't checked that until you mentioned it now.

  • I have several webstorage keys called in the format of GameSave[X][Y] like:

    GameSave00

    GameSave01

    GameSave02

    GameSave03

    GameSave10

    GameSave11

    GameSave12

    GameSave13

    and so on

    Now the X and Y after the "GameSave" are X and Y indices of an array.

    How do I use Regex (or the regexreplace or other similar regex expressions) to set a general expression to value of X and Y of array?

    I'm really bad at text-related expressions.

    The action for array is Set at (GameSave.CurX,GameSave.CurY) the "value"

    For example: GameSave13

    "Value" =

    Set "X" to webstorage.localvalue("GameSave" & "Insert Regex expression here for X" & "Insert Regex expression here for Y")

    "GameSave" & "Insert Regex expression here for X" & "Insert Regex expression here for Y"

    ^this should result to GameSave13 (and all other GameSave named keys)

    Anyone who can help me?

    Edit:

    I was just thinking of something about this:

    To simplify:

    for X

    retrieve the 1st number after "GameSave", ignore the 2nd number (which is for Y)

    for X

    retrieve the 2nd number after "GameSave" and , ignore the 1st number (which is for X)

    My indices are only up to 4 so having 2 digit X and/or Y is out of the question.

    I'm thinking if this is possible with regex?

  • nimos100

    If I save into a notepad file content like this:

    Level: 12

    Player: John

    Controls:

    jump - list key code

    right - list key code

    and so on

    How do I tell C2 to retrieve the text in line 2 after "Player: "

    I already added node webkit but I did not see an expression for something that specific, only readfile and clipboardtext

    or do I need to use Regex?

  • nimos100

    What I want to do is this:

    Say you unlocked up to level 3 and now playing level 4, when you close the game and open again, level 1-3 are still unlocked and you can start level 4 again.

    Based on the example file of C2 for game load/save, I thought you can save the "state", meaning, if you are in a level with long layout with a boss at end of layout, you can save the state just before fighting the boss. So if you die, just load the state again (you won't have to start the level, you're just back at that point (and place) before fighting the boss). This is what I don't want in my game. I would like the player to start at the very start of the same level again. That's why I save a global variable for levels and other stuff. If I misunderstood how C2's game save works, I apologize.

    Ok. I get the general idea of your examples. Don't worry. You helped me a lot with those examples.

    But I have a question:

    If I save like readable words or numbers in a notepad file, then players can easily just edit the notepad file's content ? then next time opens the game, the game would load those values? This is also about preventing players from another way of cheating I suppose.

  • nimos100

    Well, I really did not try the game load and save of C2 (after trying the example file) because it's sort of cheating for the players to always go to exact same state XD

    I want the player to at least start the highest level where he/she last played and which hasn't been cleared yet.

    About the config file, so what do I have to use? You did not specify in your first reply so I search by myself and I found webstorage and Dictionary. Please do specify if you have another better method in mind. Much appreciated. Thanks.

sgn15's avatar

sgn15

Member since 20 Sep, 2013

None one is following sgn15 yet!

Trophy Case

  • 11-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

14/44
How to earn trophies