mindfaQ's Recent Forum Activity

  • when you draw the arrow like you did ? it will point up at 0�. When you create a sprite, it will be at 0�by default. So if you would paint the arrow like this -> your assumption between 180 and 360 would be correct as the arrow would be aligned to the angle.

    The thinking for the left-right is simple. Think about it like a switch. If the switch is left (leftright = 0), you can only push it from left to right. This transfers the switch to a right position (= 1) where you can only push it from right to left.

    Active is similar, it switches (off) when a specific condition is reached, in this case the desired angle.

  • I've refined it, so the amplitude becomes more predictable and I think the movement in general more reliable:

    position every tick:

    X: sprite.X+sin(A*time*360)*sin(Sprite.Angle)*B-sprite.lastx

    Y: sprite.y-cos(2*time*360-90)*cos(Sprite.Angle)*B+sprite.lasty

    after that set 2 instance variables

    lastx = sin(A*time*360)*sin(Sprite.Angle)*B

    lasty = cos(A*time*360-90)*cos(Sprite.Angle)*B

    B is your amplitude, A your period

  • sprite.X+sin(A*time*360)*sin(Sprite.Angle)*B

    A = how fast it will swing, 1 = once up and down per second,l 2 = twice, etc.

    B = how large the swing will be, this doesn't translate directly into pixels; I strongly suggest to use x*dt where x is some number to make it independable from frame rate.

    Time is just the time elapsed in the game (this is affected by time scale (so if you pause and set the time scale to 0, the movement won't happen)). If you have further questions look up information about time and dt in Construct 2.

  • You can view the angle of any sprite by selecting it in the layout.

    If a bullet has the angle 0, it will fly right, at 90� down, at 180�left, 270�upwards if that helps you.

  • Thx Darklinki, now I understood how it is supposed to work and because of that understood the Construct 2 documentation.

    So the solution to this problem is:

    take snapshot

    and then store CanvasSnapshot as value in the webstorage under whatever key you like. And later on sprite -> load from URL: webstorage.localvalue("whateverkey")

    But I have another question: is it possible to reduce the size of the screenshot before I store it in the webstorage to save space, since it will be displayed as small version in the load menu anyway?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is it possible to save a screenshot together a save game, that I could later on display in a load menu? If yes, how can I do that? (the picture shall not be saved on the game server)

  • system compare: score > 123235342

    system trigger once while true:

    • pick random instance spawnpoint: spawnpoint spawn life on layer something imagepoint something
  • s000.tinyupload.com/index.php

    just know this: when the angle is 0 and you substract 10, the angle becomes 350 in construct. This is important to know if you are using system compare expressions like "sprite.angle = 270" (-90 doesn't work)

  • Easiest thing to do that is without the sine behavior, but instead:

    every tick: sprite set position to x = sprite.X+sin(time*360)*sin(Sprite.Angle) and y = sprite.y-cos(time*360-90)*cos(Sprite.Angle)

    if you don't want all sines to be in sync, use an instance variable for each sprite and add dt every tick to it (so ones that you created later will not be in the same phase as the others)

  • bullet movement downwards

    sine movement horizonal

  • What do you wanna do? A chess board or a board where black and white fields are randomly distributed?

    Anyway your mistake is: random(1) returns anything from 0 to 1 and a frame number like 0,123153151412 doesn't exist. If you want it to be either 0 or 1 you coud use the expression floor(random(0,2)).

    However, if you only want to create a chess board, use something like this:

    localvariable = 0

    array for each element XY: array set at (array.curx, array.cury) = localvariable

    create chesstile at x = array.curx*tilesizeinpixel and y = array.curx*tilesizeinpixel

    set chesstile framenumber = localvariable

    • if localvarialbe = 0: set localvariable = 1
    • else : set local variable = 0

    This way you alternate 0 and 1 through your array, starting with 0. Additionally at each element the tile is created and framenumber is set.

    If you create a chessboard like this, I suggest pasting all the tiles down to a canvas (with the canvas plugin) for better performance or just load an image of the board as tiled background instead of creating the tiles (you still can store information of pieces in your array).

  • Yes, wait introduces so many problems that is hardly feasible to use anywhere in a script except when doing something extremely linear that isn't influenced by anything. Better get used to use timers.

mindfaQ's avatar

mindfaQ

Member since 12 Oct, 2013

None one is following mindfaQ yet!

Trophy Case

  • 11-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies