dop2000's Forum Posts

  • Christmas Pin and Platform behaviors are not compatible with physics. Yes, they work together, but not very good.

    I'd also like to know how the author of that video did it. I don't think it's something simple though, his engine is probably quite complex.

    He might not have used Platform behavior at all. It's possible that all platform movements are replicated using physics actions (apply force, impulse, velocity etc).

  • I'm still on release 246 and don't have these issues.

    , have you tried installing an older version of C2?

    You will still be able to open your projects saved in later version if you edit this line in .caproj file:

    <saved-with-version>24600</saved-with-version>

  • You can change the size of your TextBox, but as for the word wrap - not sure if it's possible. Maybe with CSS?

    Use TextHeight and TextWidth expressions of the Text object to get actual text dimensions and resize the Text object accordingly. The only problem is that the system needs at least 1 tick (or longer for web fonts) to render the text before TextHeight and TextWidth become available.

    So it works like this:

    TextObject set Text to "Hello world!"

    Wait 0

    TextObject set Width to (Self.TextWidth+5)

    TextObject set Height to (Self.TextHeight+5)

  • Run your game in Debug Mode (Ctrl-F4)

    Find Score_Soldier in the list of variable and see what happens with it, what value it holds.

    Also just as an experiment change you action to Score_Soldier_Text -> Set Text to "1234567890"

    See if this sprite font object can display numbers.

    If nothing helps, please share your capx. It's impossible to find the problem with just your screenshots.

  • Are you saying that all blue boxes have the same FallSeconds value?

    I really don't like using events like "Every x seconds" and "Trigger once" inside of the loops.

    Try removing "trigger once" and move "Every 0.1 seconds" above the "For each" loop. See if it fixes the problem.

    If not, I suggest you enlarge your text field and add some debug output to the loop (because "Cursor is over sprite" is not a reliable method).

    So you can do something like this:

    Every 0.1 second
    For each Egg_collisionCheck    Text append newline
       cos(....)>50  Add 0.1 to FallSeconds
                     Text append "ID:" & Egg_collisionCheck.IID & "+0.1=" & Egg_collisionCheck.FallSeconds &"  "
       Else          Set FallSeconds to 0
                     Text append "ID:" & Egg_collisionCheck.IID & "reset  "
        
    [/code:2qembwov]
    
    This will help you to understand what exactly is going on.
  • If only one effect can be active at a time, then your approach is ok. I would've done it the same way.

    I think you can optimize it by changing your event 104 to "SliderBar On Changed", then you will be able to move "Call FxOff()" to this event 104 and remove it from all sub-events. Also you could remove all "Trigger once" conditions.

    You can also make a file (CSV or XML) with the list of values, corresponding effects and their names, then load this data into a dictionary etc.. But for 20 effects this would probably be an overkill.

  • Mixing platform and physics behavior in one sprite is a bad idea.

    My guess is that there are two sprites in that youtube video - the character sprite with platform behavior, and also an invisible sprite with physics behavior which follows the character copying its movements.

    Character makes all the platform stuff - running, jumping etc. And the invisible physics sprite interacts with physics objects - pushes, knocks etc.

    But this is only a theory and I may be wrong.

  • So you have 1000 frames with different heads? Why don't you split them into 100 different sprites with 10 heads each?

    Keep all these sprites on a separate (unused) layout, so that they are not loaded automatically.

    Add all 100 sprites to a family, say "HeadFamily".

    Then on start of your game layout create an instance of the sprite with the head you need.

    For example:

    System Create Head58

    HeadFamily Set animation frame 3

    This way only one sprite with 10 frames will be loaded into memory.

  • No, as far as I know, LOS behavior only checks if target object is visible or not. And it only tests the target's origin point, not its collision polygon or bounding box.

    So to find an intersection point with an obstacle, you need to use the code I posted in my previous comment.

  • Here are two ways to achieve this

    Edit: Just noticed a mistake in my screenshot - axis(0,4) is obviously wrong, replace it with axis(0,0)

  • Here are a couple of ideas - if your low height obstacle sprites are relatively small, you can add a 3rd LOS with very narrow angle of sight. Rotate your AI towards the target position, then use this LOS to check for any low height obstacles in that direction. If found - move AI to that obstacle.

    Or you can do it with a loop like this:

    dist=Distance(ai.x, ai.y, target.x, target.y)
    progress=0
    
    While
    dist>=progress
         System Pick LowObstacleSprite overlapping point (lerp(ai.x, target.x, progress/dist) , lerp(ai.y, target.y, progress/dist))
               //  point of collision with LowObstacleSprite found, you can move your AI to it
               Stop loop
         Else
               Add 5 to progress    // 5 is to minimize the number of overlapping checks for better performance. 
    [/code:34sgjorq]
    
    This code basically moves a virtual point from AI to the target, checking if it's overlapping LowObstacleSprite every 5 pixels.
    It should have almost no impact on performance, unless you have lots and lots of AI objects and executing this code for each of them on every tick.
  • Pandy

    Check this post, it may be relevant.

    I posted a few examples there where I perform hundreds of overlapping checks per tick and the impact on performance is quite small. According to Ashley, overlapping checks in C2 are well optimized.

  • Lordshiva1948

    It would be nice if you read posts (not just the title) and other people's comments before answering.

    This post has nothing to do with LAN preview.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sean080

    You can do it exactly the same way, only instead of LayoutWidth/2 and LayoutHeight/2 use person.x and person.y