help with Sprite Instances/animation

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I started to convert my project from MMF to Construct and right away i got stuck

    I have a 5 instances of sprite (kind of counter) with 5 frame animation, and a private variable "anim_var".

    What i want to do is to make a random number for the "anim_var" every time when Layout Starts

    Always -> set "animation frame" to "anim_var.
    Start of Layout -> set "anim_var" to "1+random(5)"[/code:25sjig2g]
    Everything is fine, but it set's a random value for the random instance.
    Every instance Instead of showing the same frame animation, shows random one.
    In MMF it was fine, all were showing exactly the same - i just have problems to set them to show diffrent frames.
    In Construct is completly opposite  - i can make them show diffrent frames, but i can't set them to show the same.
    and one more thing
    Is "on animation finished" working?
    MMF - works - something like thit: 2 sprites - "door" and "player":
    [code:25sjig2g]+player colides with door, press Up Arrow -> door "open" animation plays
    +"open" animation finished -> player "enter" animation plays
    +"enter" animation finished -> door "close" animation plays
    +"close" animation finished -> player set position (to something else)[/code:25sjig2g]
    It's all very simplified but you shoud get what i mean.
    In Constructor when i set "on animation finished" nothing happens.
    I'v tried to play with animation properties, but it's like one big bug 
    I've also tried to set "on animation frame" like"
     [code:25sjig2g]+animation frame equals 20 -> do something[/code:25sjig2g]
    but it do nothing.
    And the best thing is when i finally make it working I pressed the save button to save my project....and it stop working  
    I spend all weekend trying to solve that and nothing, and I have no idead what to do...
  • I haven't had any problems with On Animation Finished. I used it in my game, and there's been no new build since then. If you're experiencing what you think is a bug, post an example so someone can take a look.

    When you set an animation to a specific frame, it stops the animation, so it will never finish. When you play the animation, it plays from frame 1. This is an issue I've meant to report (I really should get those bug reports in . I totally forgot.)

    As for the rest, I really can't understand your pseudocode. You should make it more readable, I can't how you have your conditions and actions set up. Here's the standard method we use on the board:

    For conditions we use a plus:

    + Always
    For actions, indent a couple of spaces and use either -, >, or -> to indicate it's an action and not a condition:
    + Always
       ->Sprite: Set position to x,y
    For multiple conditions in an event, it's usually done like so:
    + On key "Z" pressed
    + Sprite.Value('myVar') Greater than 0
    + Sprite is visible
       -> Add 1 to Sprite.Value('myVar')
    For sub-events it would look like this:
    + On key "Z" pressed
    + Sprite.Value('myVar') Greater than 0
       + Sprite is visible
          -> Add 1 to Sprite.Value('myVar')
       + NOT Sprite is visible
          -> Subtract 1 from Sprite.Value('myVar')
    As for the sprites all setting to different frames, try generating the random number separately.  Like so:
    +Start of Layout
       ->System: Set global variable 'randFrame' to (1+random(5))
       ->Sprite: Set animation frame to global('randFrame')
    This works fine (I tested it).  Construct is a little different than MMF when it comes to instances, so it thinks you want each sprite to set itself to it's own random frame.  If you tell Sprite to set it's frame to a specific number though, it works okay.  It's not a bug, just a different way to handle instances.  You'll get used to it after a while.
  • Yeah I know, my pseudocode is a my realcode to bo honest

    I'll upload the *.cap file tommorow morning and some more readable code...

    And agree. Construct is way diffrent from MMF that's why i have problem, trying do thing same as i would do in MMF - it's hard to change old habits

  • I don't know what you did deadeye, but it all starts to work last night heh.

    But for real, i noticed that sometimes when i'm using Construct it starts making weird things.

    Like with this "on animation finished" thing. I spend all sunday trying to sort it out, and yesterday it work's fine, no problems!

    Have someone had same problems? Or maybe it's just my computer have problems

    anyway, last night results in this file

    elevators engine

    I just can't set RTS movement to go where I want. When I set it to go to ie. Y=100 it stop somewhere around that number, but never exactly on it.

    And I have to set Y position to Y floordetector position when RTS arrived on target, but it's problematic with screen scrolling.

    btw the screen is set to 1024x768 for testing, and i just realized i forgot to change it.

  • On the movement not getting to exact coords, you might try setting the image point to the center of the object, or where ever you want it to be detected at.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did that already but still the same. When the player is on level 1 floor_detector Y position = 748, the best i could do (after changing RTS deceleration to something big like 1000 or even 10.000) is to get the Winda_detector to 747.998 LOL but still missing that 0.002 .

    For the first time i have created the custom movement instead of using RTS, but it was to many lines of code, so i tried to optimize it somehow with RTS.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)