DiegoM's Recent Forum Activity

  • Let me update the first post with the new changes.

    Edit: Just updated the first post, let me know how it works for you.

  • It makes sense that if you pass 0 to the function it would do something strange.

    LoopIndex gives you a number as the loop moves from the start index to the end index.

    So in this case, if the start index = 0 and the end index = 0 - 1, then the for loop will be executed two times. The first time loopIndex will be 0 and the second time loopindex will be -1.

    If you plug those number in the calculation it is doing to place the bars, you will see it places the first one with no offset, and the second one to the left of the first.

    The function should have a special case for 0, so that it doesn't even go in the for loop and just exits early after destroying all the existing instances.

  • "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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

DiegoM's avatar

DiegoM

Member since 24 Apr, 2015

Twitter
DiegoM has 1,538,653 followers

Trophy Case

  • 10-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
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies

Blogs