AllanR's Recent Forum Activity

  • a more general purpose way would be to use regex, although it looks pretty scary and gets complicated if you also want many decimal places...

    see this thread from several years ago:

    https://www.construct.net/en/forum/construct-2/how-do-i-18/help-formating-numbers-commas-114567?kws=regex

  • the easiest way I found to make it work was to change the origin of TXT_Info_Box to "Center".

    in your "wrong" image, the text on the right is the closest because of the origin.

    Another way to fix it would be to make SP_Box_INT a container, and put the box and text in it. Then when a SP_Box_INT is selected the text would automatically be picked.

    https://www.rieperts.com/games/forum/PICK-Instances2.c3p

  • with the new function you add named parameters. Then you use the named parameter as a local variable.

    so if you add a parameter to your function called LogText, then the line would be:

    Self.Text & Newline & LogText

  • that example is using the old function type. That was a plug in that would show up under object types.

    the new function system is built in and does not show that way, because it is built in.

  • if you use frames, you could set the sprite's frame to the index of the drop down - so only one action required.

    if you use animations and use the same names in the drop down you could set the sprite animation to the drop down text.

  • you could have one sprite object and load all the different cursors as separate animations, or different frames of one animation, then set the animation or frame based on your global variable. (And set the cursor from the sprite of course).

  • like lionz said, the easiest way is to use a function. (I really don't like updating text objects every tick).

    I simplified the logic in your example a bit and added a fuction to update the correct text_value instance.

    In event 6 you don't need to pick the top items instance because the event is triggered by drag-and-drop so only one instance is already selected.

    In event 8 you were checking if "items" value was >= stack_size, but that should be "item".

    I calculate surplus by adding the item.value + items.value - stack_size, if that results in a negative number then return zero. This can be done in one action using Max()... and use Min() to set the new value to item.value + items.value, or stack_size, and then use the function to update the text_value instances.

    https://www.rieperts.com/games/forum/InventoryTest2.c3p

  • I think you had the +200 -200 reversed, which means you were looking for enemies outside the range instead of inside the range...

    try

    Enemie.X > Player.X -200

    Enemie.X < PLayer.X +200

  • it is not really the function, it is the fact that the objects created do not become "pickable" until the next top level event. You could move the actions from the function into the "On start of layout" event and they would still not work.

    another way around this is to add a Wait 0 Seconds just before the function call (as long as the fuction call is not inside a loop), because that defers actions after the wait until the end of the current tick... but people usually run into problems implementing that properly, so it would be better to add the extra "On start of layout" event.

    if the function call is inside a loop, you can pass the UID of the object to the function and pick the new object by its UID.

  • Objects do not finish the creation process until the top level event that creates them finishes. So, You can not call a function in that event - as far as the function is concerned, the objects do not exist yet.

    the easiest solution may be to add another "On start of layout" event immediately after the current one, and call the function from there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • under Platform Info you can check if Wake Lock is supported, then request to turn it on to keep the screen on.

  • the easiest way may be to create a layer and set the parallax settings to 0,0

    (and put the object on that layer)

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • 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

19/44
How to earn trophies