peter568's Recent Forum Activity

  • You'll need AJAX and an Array Object in your project.

    Right click the 'Files' folder in the project tab, pick 'New -> Array'.

    Set width to 4 and height to 3. Then put the data you want in each cell.

    In the event sheet:

    'On Start of Layout

    -AJAX -> Request Project File (pick the name of the array.json you made. Tags can be whatever)

    -System -> Wait for Previous Actions

    -Array -> Load -> AJAX.LastData'

    This uses AJAX to load in the array from the file you made. Then, when finished loading, the Array object copies its contents by grabbing the last data loaded through the AJAX object.

    To check if it worked, use the 'Debug Layout' mode. Click the 'Array' object you made on the list. If it shows you a section called 'Data' with cells that match the ones from the file, you're good to go.

    From there, how you choose to visualize the data in the game depends on what you're using it for.

  • Saving the file to downloads works, but the 'FileChooser -> On Changed' event triggers a 'load failed'.

    I was able to fix the issue by loading the chosen file into AJAX first, then loading JSON from AJAX.LastData. Not sure what caused the issue :/

  • Many games will share a single event sheet for the logic that all levels have in common. In those cases, you have to call the name of the song using data from the layout itself.

    Best practice is to put a Sprite Object in your level that has a String variable with the song you want to play for that level.

    Then,

    On Start Of Layout -> Audio -> Play (by Name)

    "Folder: Music

    Audio File Name: Sprite.String (for example, MusicManager.SongToPlay)"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, thank you for the clarification.

    construct.net/en/forum/construct-3/how-do-i-8/write-array-localstorage-129837

    I found this thread and it's pretty close to what I need, I should be good to go

  • For a web-based game, I'd like the player to be able to save their progress to a downloadable file. That way, they can resume their progress from another device if needed, as long as they have the file on a flash drive, cloud, etc.

    Is this possible, and if yes, how could I achieve this?

    Tagged:

  • I want to implement the ability to save all of the player's scores to an array, along with the time and day those scores were achieved so they can view them on a timeline, or organize them onto a high score table.

    I know it's possible to load data from a JSON array into an array object, but is it possible to load updated scores from the player back into the JSON?

    If not, what other solutions would be best for this?

  • Put a Text Object where you want it on the screen and set it invisible by default.

    Use 'Compare two values'. If (number of collected buckets) is equal or greater than (number of required buckets), use the 'Set Visible' action for the Text object.

    As for stopping the game, there's multiple ways you could do. You could disable whichever behaviors you're using to control the character, or set the time scale to 0 in 'System'. But time scale 0 will make everything stop completely.

    Ideally, you should give your player a way to restart the game without having to refresh/exit the game. You could use 'System -> Restart Layout' for that.

  • Hi,

    I want to use the Tile Movement behavior for controlling an RPG character on a grid. What's the most efficient way to determine which direction the character is moving in, and the appropriate directional animation to select?

    When I worked with the 8-direction behavior in the past, I could round their movement angle to the nearest 90 degree, and then use that to choose the animation name. But Tile Movement doesn't have an expression for which direction the sprite is moving in.

    And as a side question, if I want the player character's party members to follow behind them, how can I achieve that?

  • Changing the value made it work exactly how I needed it, tysm! 👏

    I haven't used Lerp before. I'm out of touch with programming math and have a lot to learn lol

  • The lerp solution worked, thank you! Though now the movement feels like it has a bit of lag, like it has to take a moment to accelerate upwards to the finger's speed.

  • Hi,

    For a game, I'm using the Touch object to move a character. I want its movement to match the finger's direction dragged across the screen.

    The two solutions I've tested so far are:

    1)'Move At Angle' action with Touch.SpeedAt() * dt and Touch.AngleAt()

    2) Bullet behavior with angle of motion set to Touch.AngleAt and speed at Touch.SpeedAt

    Both solutions work, but the movement is often stuttery and doesn't exactly match the finger's drag: Sometimes it flies farther than I wanted it to, sometimes the movement has pauses on frames, etc. I thought it might be a performance issue, but the game is running fine at 60fps - no interruptions across any platforms I've tested on.

    Is there something I'm doing wrong? Or a different method I can use?

  • Ok, I tried it again and got it working. I used a local variable inside the event to check the IID of the Entrance, and then I set the vehicle's position to the Exit that matches that IID. Thank you!

peter568's avatar

peter568

Member since 18 Dec, 2020

Twitter
peter568 has 1 followers

Trophy Case

  • 4-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

7/44
How to earn trophies