R0J0hound's Forum Posts

  • I won’t be doing that.

  • Deformations can be done without webgl. I’ve done it before in plugins, it’s just not super fast.

    If you want to do deformations now, there are a few plugins that can be used.

    For one, there is the creature2d plugin. It does mesh deformations but you have to design them with the creature2d software. There may be another plugin for some other animation software as well.

    If you want to do the deformations manually with events. There is the custom draw and paster plugins. They both let you draw deformed quads. Combine multiple quads together and you can get some nice effects. The paster examples are a bit harder to find in the plugins topic.

    If neither of those float your boat then you can make your own plugin I suppose. The sky is the limit.

  • Ai can be many things. You’ll have to break it down in more detail what you want the enemy to do.

    By doing that you should be able to have a lot of simpler things you can figure out how to do easier.

    Then if you still get stuck you’ll have some more specific questions and be able to get more specific help.

    Anyways as broad a question as it is you could look into the pathfinder or line of sight behaviors as a start. But there is a lot more different ways to do ai.

  • There isn't any expressions to get the current effect parameters.

  • You could use a global layer to be DRY.

  • You could try the persist behavior. It makes things stay the same when you leave a layout and come back.

    Another idea is to just have the inventory on a layer that you keep hidden most of the time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's just a matter of saving the position of one of the objects to some variables and then setting the position of the objects to the other.

    global number tempx =0

    global number tempy = 0

    start of layout

    --- set tempx to sprite.x

    --- set tempy to sprite.y

    --- sprite: set position to (sprite2.x, sprite2.y)

    --- sprite2: set position to (tempx, tempy)

    For the example of swapping pieces around, i'd assume they are all instances of the same object type.

    global number tempx =0

    global number tempy = 0

    global number iid1=0

    global number iid2=0

    start of layout

    repeat 100 times

    --- set iid1 to int(random(sprite.count))

    --- set iid2 to int(random(sprite.count))

    ------ pick sprite instance iid1

    --------- set tempx to sprite.x

    --------- set tempy to sprite.y

    --------- sprite: set position to (sprite(iid2).x, sprite(iid2).y)

    ------ pick sprite instance iid1

    --------- sprite2: set position to (tempx, tempy)

  • Nice. Glad it helped

  • Could making it global and just hiding it/disabling it’s solid behavior when changing to another layout work?

    The idea is to just always keep it loaded to avoid the recreating overhead which is more significant due to the amount of tiles.

  • It’s not hard, there’s just many ways to go about it.

    I’d go for one array for the deck, and a card sprite for everything else since they are visible. To be able to differentiate between played cards and cards in the hand you could just add a Boolean instance variable inhand that with a default value of true.

    So assuming you have the deck array already populated you can deal your hand with:

    Start of layout

    Repeat 5 times

    — creat card at (0,0)

    — cars: set animation frame to deck.back

    — deck: pop from back

    Then to position the cards in a row it would be

    Global number numcards=0

    Card: is inhand

    — set numcards to card.pickedcount

    For each card ordered by card.x ascending

    — card: set position to (320+(loopindex-(numcards-1)/2)*card.width, 400)

    So then to play a card it’s as easy as setting inhand to false and moving it to where you want it. The gap will close up. Same with dealing new cards, just create it with a low x to slide in from the right. Curved is also possible, you just change how you set the position.

    Card: is inhand

    For each card ordered by card.x ascending

    — card: set position to (320, 400+500)

    — card: set angle to (loopindex-(numcards-1)/2)*5

    — card: move 400 pixels at self.angle-90 degrees

  • Construct uses doubles for the numbers so the largest number is around 10^308. It's most certainly a bug:

    You can get around it by doing this:

    global number ten = 10

    money > ten^18

    money < ten^19

  • Problem Description

    When you put an expression like 10^20 in events it is calculated wrong.

    Attach a Capx

    https://www.dropbox.com/s/vv6hmwuk77fp1 ... .capx?dl=1

    Description of Capx

    It does two simple expressions and displays the result.

    v1 = 10^20

    ten = 10

    v2 = ten^20

    but 10^20 calculates wrong and ten^20 calculates correctly.

    Steps to Reproduce Bug

    • Write 10^19 in an expression. 10^18 works, but 19 and higher doesn't.
    • It must be an issue with the constant folding since we can bypass the bug by using a variable ten=10 and then doing ten^19 to get a correct value.

    Observed Result

    v1 = -9223372036854776000

    v2 = 100000000000000000000

    Expected Result

    v1 = 100000000000000000000

    v2 = 100000000000000000000

    Affected Browsers

    • Chrome: (YES)
    • FireFox: untested
    • Internet Explorer: untested

    Operating System and Service Pack

    win10

    Construct 2 Version ID

    250 x64

  • If you move the island over the path so they are lined up and save the x,y position of the island to some vars: startx, starty then you can have some sprite dummySprite that you move along the path as normal, only you'd make that invisible. Then you can move the island anywhere and set the position of another sprite to

    x = island.x+dummySprite.x-startx

    y = island.y+dummySprite.y-starty

    and the path will move with the island.

  • Just use it instead of the first code. I kind of paraphrased the expressions but it should be useable. At the end of it the highest value will be

    Array.at(index1)

    And the second will be

    Array.at(index2)

    You’ll want to reset both vars to 0 before running that event.

    If there is a tie then then it will still work. Barring any flaw to the idea.

    edit:

    Actually that won't work right for finding the second highest value in some cases. Do this instead: loop over the array twice. Again you'll want to reset the variables to 0 before running the two loops again.

    global number index1=0

    global number index2=0

    array: for each x

    compare: array.curvalue >= array.at(index1)

    --- set index1 to array.curX

    array: for each x

    compare: array.curx != index1

    compare: array.curvalue >= array.at(index2)

    --- set index2 to array.curX

  • I suppose. I’ll try to give a possible example.

    But it’s probably simpler to sort the array. If you want to remember the original indexes, you can add another column and set the values there to the indexes before sorting. If you want to leave the original array alone, you can copy it to another first with the asjson expression.

    var index1=0

    var index2=0

    Array: For each x

    Current value <= array.at(index1)

    —- set index2 to index1

    —- set index1 to curx