R0J0hound's Forum Posts

  • With unbounded scrolling on, make a duplicate of the tile map and put it right above the layout and another right below. The jump from moving the player from the top to bottom should be mostly undetectable. The wrap behavior is likely not sufficient so you’ll have to do:

    Player.y<0

    —-set y to self.y+layoutheight

    Player.y>layoutheight

    —- set y to self.y-layoutheight

    So basically you’re just duplicating everything to make it look seamless. You can probably get away with one deplicate instead of two if you position the duplicate depending if the player is close to the bottom or top. Moving objects can be trickier but the duplicate is always at the same offset from the original, a y difference of layoutheight.

    I’ve also used the paster object instead so that you draw the bottom part of the layout to it and move it above the layout when the player is near the top. The bottom is handled in the same way. Tile maps won’t work as is with paster because only the tiles onscreen will be drawn as an optimization. The trick to make it work is to move the paster and tile map objects onscreen first before drawing.

    Either of those will make it look like it’s seamless. Next thing to deal with is making stuff work across this seam. They’d have to be handled on a case by case basis.

  • That should be the case. Maybe post a screenshot of the event.

  • Just do it with events. Give the robot three variables vx=0, vy=0, and gravityStrength=400. In the click event it shows how to set vx and vy from a speed of 200 and an angle of 45.

    Global number gravityDir=0

    for each robot

    --- set gravityDir to angle(robot.x, robot.y, planet.x, planet.y)

    --- robot: add self.gravityStrength*cos(gravityDir)*dt to vx

    --- robot: add self.gravityStrength*sin(gravityDir)*dt to vy

    --- robot: set postion to (self.x+self.vx*dt, self.y+self.vy*dt)

    --- robot: set angle to angle(0,0,self.vx,self.vy)

    on click

    --- create robot at (player.x, player.y)

    --- robot: set vx to 200*cos(45)

    --- robot: set vy to 200*sin(45)

  • To arrange the sprites like in your example you can do this:

    for each sprite

    --- set position to (lerp(100, 300, loopindex/(Sprite.count-1)), 400)

    100 if the leftmost x and 300 is the rightmost. 400 is the y.

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

  • Try Construct 3

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

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

  • 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