R0J0hound's Recent Forum Activity

  • Glad it worked and was helpful.

    -cheers

  • Don’t use the behaviors. You can make the motion with events simple enough.

    Give the object you want to move two instance variables:

    Speed and ang. That’ll be your speed and angleOfMotion.

    Then the motion can be done with one event.

    Every tick

    — sprite: move self.speed*dt pixels at angle self.ang

    Then for the bounce it should be as simple as adding 180 to ang and moving out of the wall. Here’s what it should look like. The while and second overlap condition are in a sub event if that’s not clear.

    It moves out a pixel at a time but you can do a smaller step if needed.

    Sprite: overlaps wall

    — sprite: add 180 to ang

    ——while

    ——sprite: overlaps wall

    ——— sprite: move 1 pixel at angle self.ang.

    -cheers

  • Updated the example to write an image url to the clipboard.

    Internally it creates an image and a canvas, loads the imageUrl into the image, draws it to the canvas, gets a blob from the canvas, and sets the clipboard from that.

  • dropbox.com/s/bfxii1ius92fee0/card_fan.capx

    Basically put all the cards in the same spot. Rotate each a bit, and then move them at an angle.

  • This works on chrome 84 to load an image from the clipboard. Not sure if other browsers do it differently. It was a bit different than the mozilla documentation about the clipboard api.

    Writing to the clipboard is possible too but I had nothing to write.

    dropbox.com/s/yeoltfvz63hpasb/js_read_image_from_clipboard.capx

    For c3 I think you may need to change c2_callFunction to c3_callFunction, unless something else changed with new functions.

  • mid(line, 8, 100) is extracting the name. It starts at character 8 since “#recipe” has a length of 7 and I added 1 more to skip the space after it too. 100 is just arbitrary. I just needed something well over the length of the line. It basically just gets the rest of the line.

    int() also converts text to a number. It just gets any digits and then stops when it hits anything else.

    I used it as a shortcut to just grab the number at the beginning of the line.

    I turn it back into text and get it’s length so I can know what character to start at for mid.

    I guess I wasn’t consistent to use trim. I could very well have added 1 to account for the space

    mid(line, len(str(count))+1, 100)

    The trim is nice to use though. Gets rid of any unintentional trailing spaces.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh sure. It takes the file and uses the tokenat expression to look at it a line at a time.

    One event sees if the line starts with #recipe, if it does it uses the rest of that line as the name of a new recipe.

    The other event handles either blank lines or lines that have a number followed by an ingredient name.

    Left() gets the left side of some text

    Mid() gets the middle

    Trim() removes any leading and trailing spaces in the text.

    Finally it keeps track of the uid of the last recipe created. That is just so we can pick it again when adding ingredients to it.

  • You set the variables from the bullet behavior right after so it nulls any changes you do before. Move the gravity action down to fix that.

    It’s probably not what you’re after though. Curved motion for pool balls is caused by friction between the ball and the table as the ball spins around in 3D. The physics model as is doesn’t account for that.

  • It’s converting binary to decimal. So instead of a three digit binary number like 101 it turns it into a number 0 to 7.

  • You could take event 5 and delete all its sub events and actions.

    Then add this one action:

    b: set value at a.curx to int(mid(“11100001”, 4*a.at(a.curx-1)+2*a.at(a.curx)+a.at(a.curx+1), 1))

    No idea if it’s faster but it’s more compact.

  • Here's an old topic with an example to find out if an object is inside a polygon that may be helpful.

    It's rather old so there may be ways to simplify/clean it up to be simpler.

    As far as coloring the shape you'd probably want to look at the canvas object. Not quite sure what it can do since i don't use c3.

    Edit: oops forgot the link

    construct.net/en/forum/construct-2/how-do-i-18/drawing-loop-around-bubbles-71853

    Edit2:

    updated example:

    dropbox.com/s/rpi4nzhd763b4l6/pointInPoly.capx

  • Thought I'd have a go at this.

    The events simplify nicely by having a dictionary for the inventory and an instance of a recipe dictionary for each recipe.

    dropbox.com/s/cw1xuiiymjqq6oq/crafting_test2.capx

    JSON and XML are a pain to write imo. With the above example you can just create the recipes with events fairly cleanly, or just load and parse a plain text file to populate it.

    #recipe Blinding Flash Potion
    2 wormwood
    5 sulfer
    
    #recipe Potion of Sweet and Savory
    5 salt
    5 sugar

    I could get behind writing recipes like that all day long. No quotes or matching brackets.