Yann's Forum Posts

  • here is one possible way

    pathLister.capx

    listing all possible path, then it's just a matter of choosing amongst them.

    Unfortunately it's a pretty expensive calculation. As you can see for a 6x4 grid you already have more than 5000 thousand possible path.

    Which means a lot more calculations.

    However you can easily get a complexity score for each path using lenth and/or how many turn they have.

  • here's a simple solution

    basicEventBasedStateMachine.capx

  • Sorry if I offended you with my answer Excal, but I tend to try to understand why the question was asked and come up with something simple just in case.

    Here is my answer to the question "is there a formula to determine the shortest type of rotation (clockwise vs. counterclockwise)?"

    rotationType.capx

    There might be a complex formula for that, but I would do it this way. It's simple to understand and debug. And the function themselves could be used for other stuff in your project.

    (also sine and cosine is known to be a slow operation)

  • Every Tick
       -> Sprite: Rotate ROTATION_SPEED * dt degrees toward target.Angle

    isn't enough for what you need? (:

  • TELLES0808

    dividing by zero isn't infinite. It's undefined. But yeah, javascript wrongly returns Infinite (should return NaN or undefined).

    Subscribe to Construct videos now

    (:

  • R0J0hound

    indeed thanks (:

  • the do while is a special case of a while function in a programming language, where the predicate is evaluated at the end of the code block it executes.

    so you usually have

    Always do the first iteration, and then if the predicate is true reiterate.

    So to simulate something like

    set i to 0
    do {
     append i to text
     i = i + 1
    } while (i < 10)

    you would do

    + system: every tick
        -> system: set i to 0
        -> text: append i to text
        -> system: add 1 to i
    + system: while 
    + system: i < 10
        -> text: append i to text
        -> system: add 1 to i

    as you see a do while is merely a syntaxic sugar to avoid repeating some of the code you write.

  • yeah for the masking to work, you need the mask to be another object since you need it to be on the same layer as the shadow, and also on top of them.

    Now if you double the amount of object, you indeed augment the amount of calculation.

    And, if you use the ZSorter plugin, I believe it does things automagically every tick.

    But if you handle sorting by yourself, you can trigger the sorting actions whenever you want.

    So you can just limit the recalculation each time you move an object in the Y axis more than a given number.

    One way to do this, is to use the function plugin and to create a "sort" function that will reorder the sprites

    Then when you drag an object, or move your character, you monitor the Y position by storing it each time you sort the sprites (so you do the storing in the "sort" function.

    Then when the difference between this value and the actual Y position of the moving sprite is greater than a given value (probably proportionnal to he size of your grid), you call the "sort" function.

    Hope it wasn't too complex :D

    Anyway, I think the best thing you can do to take your final decision is to run some stress test on the devices you target.

    Maybe you can just decide to use one technique on desktop and another on portable devices. There's probably a way to make a simple switch so you can release easily two version.

  • here's my idea

    shadowMasking.capx

    you have all the shadow in one layer which is at 40% opacity, so they blend well

    And they shade units on layer main if they don't have masks

    I'm not at home so I don't have all my image editing tools, but you can even try to make the tower mask fade toward the bottom to get some subtle casted shadow.

    (Edit: hmmmm nah wouldn't really work, the shape of the shadow wouldn't make the cast on the tower good)

    I don't think you'll get better result than that without going 3D

    On thing that might not be obvious is that the shadow layer has "force own texture" to yes for proper masking.

  • TELLES0808

    hey thanks

    Well, was busy with the C2 class and some other stuffs.

    I get that shadow overlapping each other is an issue but he seems to have the right work around: lowering the layer's opacity instead of the individual shadow's opacity.

    and as far as the character's shadow is concerned, he merely talked about "objects being always in shade" vs "no objects will be shaded, only terrain".

    So as much as I understand why only shading the terrain would be bad, I don't understand why "object being always in shade" is a problem if they are supposed to be shaded by another object...

    So I think I'm mostly misinterpreting the problem and ask for an illustration of it just to be sure.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • And if the layer is placed above, objects will be always in the shade.

    Can't see why it's a problem... Isn't it what usually happens in the real world? object in the shade... are in the shade?

    Now maybe your shadow shape covers too much of your object? you might get away with just cutting the shadow around the object?

    Maybe an illustration of the problem could help (:

    Anyway I like what you did. Especially with wall construction.

  • Just rewrote the thing as in the first link o.o

  • demo

    capx

    (Though it wouldn't be hard to make a plugin for that)

  • hyem

    everythin is listed in the page

    http://ureddit.com/class/76284/making-games-with-construct2

    The video I am refering to are the one in lecture 0: prelude

    So it's:

    Download and Installation of Construct2

    Subscribe to Construct videos now

    Also if you have better ideas to make things more visible, let us now (:

  • Hey guys,

    One of our student just told me it wasn't so obvious.

    So let me remind you that we are on reddit.

    For those who don't know what reddit is, think about it as a very global forum. There's a bit of gamifications (karma points) but overall it's a forum where you can post either a simple link or a main post. Both can be up/down voted and receive comments.

    So don't hesitate to create an account and post any question you have about this class (:

    (Yeah unfortunately an uReddit account isn't a reddit account, though they can be linked)