DiegoM's Recent Forum Activity

  • "Amount" is the function parameter for "CreateItems", function parameters look like local variables. You can try right clicking on top of the function and selecting "Add parameter" to see how adding more would look like.

    When the function is called, "theNumber" is passed in so then inside the function "Amount" takes that value. For this contrived example it wasn't really necessary, just using "theNumber" inside the funtion would have worked the same. If you try replacing "Amount" by the "theNumber" in the for loop, it should be the same.

    The reason I have the loop starting at 0 and ending at amount - 1, has to do with the calculation to position the items. I want the first LoopIndex to be 0, so the first item will not have any offset applied to it.

  • This is one way of doing it.

    dropbox.com/s/8u9ml9l2mld32pp/generateObjectsToMatchNumberCount.c3p

    The example doesn't do line breaks, so all the items are added in a single line, but it's a good starting point.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Look into the Set Instance action of the Timeline plugin.

    The Timeline Instances example project in the Start Page is a basic example of how to use the action to re-use a timeline animation with multiple different instances.

  • I think the issue is that the crouching animation is playing WHENEVER the arrow key is down and the uppercut, only when W is pressed.

    So what ends up happening is that the crouching animation is played, then for a brief moment an attempt is made to play the uppercut animation when W is pressed, but because the down arrow is continuously pressed, the crouching animation takes precedence.

    I think that you need to set a boolean variable when you press W to indicate that an attack has started and while that variable is true don't play the crouching animation, then it won't step over the uppercut one.

    You will need another event to know when the uppercut is complete, so you can reset the boolean and allow the crouching animation to play normally.

  • An easy way of doing it without scripting is to use the Load image from URL action on a Sprite instance.

    When that is loaded, you can use the Paste object action of Drawing Canvas to copy the image data over.

    After that you can get rid of the sprite instance.

  • Cool, well done!

    Before I forget, yesterday I found the full reference for the library, but it's a bit hidden away. It's very useful when you go past the basic examples.

    docs.mongodb.com/realm-sdks/js/latest

  • I am just guessing here, but judging from the console errors, there seem to be syntax error in either here

    const mongodb = app.services.mongodb("mongode-atlas");
    

    In this one, I don't think app has any property called services. Maybe you need to do something like this

    const mongodb = app.currentUser.mongoClient("mongode-atlas");
    

    Haven't actually tried this myself, just stitching together things I find that look like they make sense.

    The next line

    const collection = mongo.db("ServerDB").collection("UserAccounts");
    

    I think should be

    const collection = mongodb.db("ServerDB").collection("UserAccounts");
    

    Maybe that won't blow up, but it is still not doing anything useful, just getting some objects.

    Next you can try with

    collection.updateOne({ $set: { myNewProperty: "foo" } })
    .then(() =>
    {
     // Refresh the user's local customData property
     return app.currentUser.refreshCustomData()
    })
    .then(() =>
    {
     // try to console.log the custom data here to see if something changed
    });
    
    

    After doing this also check the database, to see if that was updated.

    I don't think I can help anymore without actually working on this :P

  • Just one more thing I noticed reading the documentation.

    docs.mongodb.com/realm/web/access-custom-user-data

    There is a warning about stale data.

    So you might want to try doing

    await app.currentUser.refreshCustomData();
    

    before getting the custom data to make sure you are getting the latest available.

  • It's hard to tell without looking at your project.

    If you take the example and just change the GetDate function to return Date.Get(2021, 11, 12, 19, 0, 0, 0), the count down works as expected. So I imagine that in the process of copying and pasting you maybe forgot something or there is something that needs to be changed and you missed it.

    The parameters for the Date.Get expression are as follows:

    year => 4 digit number
    month => 0 to 11
    day => 1 to 31
    hour => 0 to 23
    minutes => 0 to 59
    seconds => 0 to 59
    milliseconds => 0 to 999
    

    So Date.Get(2021, 11, 12, 19, 0, 0, 0) should get you the date for December 12th 2021 at 7pm

  • It seems you need to enable custom user data before you are able to use it.

    docs.mongodb.com/realm/users/enable-custom-user-data

  • Is this how you are setting the custom data?

    docs.mongodb.com/realm/web/access-custom-user-data

    I would try doing it that way, and then see if retrieving it works. There is a note about write permissions, which I am not too sure what it means, but it might be worth to keep it in mind if you can't write the data.

  • What have you tried doing to set the custom data?

    I am not very familiar with the library, but if it is returning an empty object, then it is likely nothing was set to begin with.

DiegoM's avatar

DiegoM

Member since 24 Apr, 2015

Twitter
DiegoM has 1,775,524 followers

Trophy Case

  • 11-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • 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
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

20/44
How to earn trophies

Blogs