Yann's Forum Posts

  • I think it's totally in the realm of possibilities, but it would require a plugin.

  • This sprite thing is a nice idea

    To handle what you ask, you should just set a counter variable on your sprite and decrease it each time you spawn an enemy related to this sprite.

    If the counter reach 0 you destroy it.

    Now I wonder why you use a family for that though

  • McKack

    This would be slightly better

    memCard.capx

    Using the 'on start of layout' you avoid the glitch you have on start when you see the text appearing and also you avoid running your loops all the time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would do something along those lines :

    you have the 'Card' sprites with your different symbol in each animation frame.

    You add an instance variable called 'set' of type boolean and default to false

    You just have to do a loop like:

    +System: for "card" from 0 to Card.animationFrameCount-1
      +System repeat 2 times
      +Card: [invert] is 'Set'
      +System: pick random Card
          -> Card: set animation frame to loopindex("card")
          -> Card: set 'Set' to True

    Then to know if you picked two matching cards you just have to compare their animation frame (:

  • Hi,

    I'm working on some CC project to help some student at my former artschool making their game prototype, and I ended up using 'frame speed' for the first time to tweak some animations and save up some VRAM.

    At first I wondered if it was really a speed (ie: if the number is higher it will go faster). But it's an actuall duration or what is called 'exposition' in the field of animation.

    So it might be better to name this property 'frame duration' or 'exposition' depending on what you think will be easier to understand.

    I'm reporting it since the same terminology is used in C2.

  • UID means Unique ID

    IID means Instance ID

    UID are number assigned to all the object of your layout. Two objects will never have the same UID and if you create a Rocket you'll get the next UID of the whole project

    Thus UIDs are IDs in a per layout basis

    IID are IDs in a per instance basis and it looks like what you described.

    To pick an instance by its IID the proper expression is a system expression. System: pick nth instance

    (darn been ninja'd)

  • depends, but yeah it could

    If you keep track of each waves timing via the array I mentionned

    Like

    Array.At(wavenumber,2) = startTime

    Array.At(wavenumber,3) = countDown

    Array.At(wavenumber,4) = rate

    you can use the 'countDown' and the rate value to control the spawning of each wave of monster, instead of using a global "every x seconds"

    So each tick you check for each possible wave, if the startTime is exceeded, if it is, you check the 'countDown',

    if it's equal to 0 you spawn the next enemy and add 'rate' to the 'countDown',

    else you substract dt to it.

    Something along these lines

  • dcrew tackled the problem in the proper way.

    If you end up with 30 waves and you need to change something, you'll need to change it for all 30 waves. That's a real pain.

    You need to be able to encompass all your needs in only one configurable wave you restart each time. With just the number of the wave which change over time.

    One way to add flexibility is to use an array of parameters like

    Array.At(waveNumber,0) = number of ennemies

    for a list of enemies

    Array.At(waveNumber,1,0) = number representing an enemy type

    Array.At(waveNumber,1,1) = number representing an enemy type

    Array.At(waveNumber,1,2) = number representing an enemy type

    etc

    And use these information to spawn the proper number of enemy and type of enemy.

  • I tested with the map you find with the Tiled installation.

    perspective_walls.tmx and isometric_grass_and_water.tmx.

    The sprite seems properly placed in the layout, and the layout has a proper size. But the animation frame aren't properly cropped and you should set the animation speed to 0.

  • you could put your points in a family fpoint

    and then

    Global alignement = 0
    +[pick the three points you want to check with the object type point]
    +[pick the three points you want to check with the family fpoint]
    +system: pick point at random
      local number a1 = 0  // angle between point and the first fpoint
      local number a2 = 0  // angle between point and the second fpoint
      +system: for each fpoint
      +system: point.UID != fpoint.UID // don't pick itself
        +loopindex = 0
          ->system: set a1 to angle(point.X,point.Y,fpoint.X,fpoint.Y)
        +loopindex = 1
          ->system: set a2 to angle(point.X,point.Y,fpoint.X,fpoint.Y)
      -> System: set alignement to min(1,abs(cos(a1)*cos(a2)+sin(a1)*sin(a2)))

    Basically it should look at one of your 3 points and calculate the angle between the other two.

    So if the point randomly picked is at one extremity, the angle between this point and the two others should be the same.

    If the point randomly picked is the middle one, the angle should be opposite.

    To compare alignement between two direction (or vectors) there's a neat operation called dot product.

    If done on unit vectors (the ones with length = 1) you get a number from -1 to 1:

    * 1 = aligned and pointing toward the same direction

    * -1 = aligned and pointing toward opposite direction

    * 0 = perpendicular

    and between these values it would be a "percentage of alignement"

    The formulat is:

    given two vectors v1(x1,y1) and v2(x2,y2)

    the dot product v1.v2 = x1*x2+y1*y2

    If you have an angle 'a', the corresponding unit vector would be (cos(a),sin(a))

    That's why cos(a1)*cos(a2)+sin(a1)*sin(a2) should give you the dot product.

    the abs() is to have values from 0 to 1 that should give you a percentage of alignement.

    you then just have to check if 'alignement' is greater than something lik 0.9 and you're done (:

  • kittiewan

    This might be sligthly better, the overhead would just be on start of frame to fill the array if you have thousands of values.

    samplingWithoutReplacement.capx

  • Set VectorX and vectorY to 0

  • Yeah I used image points to have a precise start for the red sprite.

    it's made so the sprite that grows from 0 to it's max height will really start at the border of the outline, so you should see something between 0 and 1 HP out of 100.

    Else it would be hidden behind the outline.

  • +on start of layout
      -> spawn platform at random(layoutwidth),random(layoutheight)
      +platform: [invert] is SET
        +while
        +platform: is overlapping object
          -> platform: set position to random(layoutwidth),random(layoutheight)
        +[empty]
          -> platform: set SET to true

    put your platform in the family 'object'

    and add a boolean variable 'SET' with default false