My 'Help Me' Thread

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 6) Pause:

    Dunno if I got that logic right. What I did was:

    On "Pause" pressed - System: Set Time Scale to 0

    That works. Then I want to set the Time back to 1 if I hit "Pause" again. So my thought was:

    On "Pause" pressed, Timer is equal to 0 - System: Set Time Scale to 1

    I guess my thought process is wrong in that case, right?

    2) The 'GoldValueField' - I have a HUD with a Text called 'Gold' - underneath it, I wanted to create a text object (called 'GoldValueField') that displays the Gold value from the 'Gold' global variable that I set. So I created a:

    Start of Layout - goldValueField: Set text to global('Gold')

    Now, it seems to work, since it displays that global variables initial value (0)

    Then I created a 'coin' object and wanted to add '10' to the Gold global variable whenever a coin is collected, so I created this event:

    Player overlaps Coin - System: Add 10 to global variable 'Gold'

    Didn't work. I grab the coin, but the goldValueField doesn't update. It still says '0'

    The curious thing is that the same event works for private variables.

    I have a 'heart' object and created the following event:

    Player overlaps Heart - Player: Set 'Hearts' to 1

    And I have a heart icon in the hud that has 2 animation frames. If the 'Hearts' Private Variable is set to 0, it displays the EmptyHeart Frame. If the 'Hearts' variable is at 1, it displays the full heart.

    This works. It's the same logic behind both events, it works for private variables, but doesn't seem to work for global variables. What am I missing here?

  • On "Pause" pressed - System: Set Time Scale to 0

    That works. Then I want to set the Time back to 1 if I hit "Pause" again. So my thought was:

    On "Pause" pressed, Timer is equal to 0 - System: Set Time Scale to 1

    I guess my thought process is wrong in that case, right?

    You're changing your TimeScale from 1 to 0 and back to 1 in the same tick. Use Else:

    +On "Pause" pressed
      +TimeScale is equal to 1
         ->Set TimeScale to 0
         ->Set TimeScale to 1
    As for this...

    Start of Layout - goldValueField: Set text to global('Gold')

    Look at that trigger there. It says "Start of layout." So when do you think it will perform that action?

    Try "Always" insead

  • Oh man, that makes so much sense now

    My thought process was that 'Start of Layout' means that the event starts as soon as the layout starts and then just keeps going.

    Thanks a lot for the constant help, deadeye, you rock!

  • A slightly simplified version of doing the TimeScale is..

    • On pause pressed

    + Set TimeScale to 1 - TimeScale

  • - On pause pressed

    + Set TimeScale to 1 - TimeScale

    Could you elaborate on that? Not quite sure how I'd set that up.

  • Exactly as it's shown...

    "1 - TimeScale" means "one minus the current TimeScale value," so if your TimeScale is 1, then it's 1 minus 1, which equals 0. If it's 0, then it's 1 minus 0, which equals 1. It's like a toggle switch.

  • Ah, got it. I thought 0 - 1 = -1.

    Or are there no negative values in Construct?

  • It's never subtracting anything from 0, only from 1 .

  • AI thought 0 - 1 = -1.

    0 - 1 does indeed equal -1. But that's not what's happening here.

    The equation indicates it will either be 1 - 1 or 1 - 0. Neither of which is 0 - 1.

    1 - 0 /= 0 - 1.

    1010100010011101010100101010011101 010101100100100101

  • Alright, next problem. I quickly recorded a video to demonstrate it: ... bar_01.avi

    Basically, I created a progress bar that shall act like a healthbar later on. So if you attack an enemy, it shows you how much energy the enemy still has left.

    I want the healthbar to always follow the Mushroom sprite, but it acts weird when the screen starts to scroll.

    My event was:

    Always - healthFieldMushroom: Set X to Mushroom.X

  • Hard to say. As nice as video demonstrations are, you can't really tell too much from them. It would be easier to see your .cap.

    Mu guess is that you have the health bar on a different layer that has different scrolling settings. If not... well, like I said, it's hard to say.

  • Nah, that was also my first thought, but that's not it. Still haven't figured it out, but I'll post the solution once I will.

    Anyway, here's another one:

    9) I added an 'attack' control and have my 'animation' event sheet pretty much set-up like you did in the platforming school thingy.

    What I want to achieve is this: If the player presses 'Attack' once the 'Attacking' Animation will be played once. And after the attacking animation has been played once, the character will be back at 'Standing'.

    Now, my attack event is:

    On "Attack" pressed - Player: Set "IsAttacking' to 1 (private variable for the player)

    Value "IsAttacking" equal to 1 - Player: Set animation to "Attacking"

    Now, what I don't get is how to tell Construct that it should only play the animation ONCE and then return to the "Standing" stance. If I press the Attack key now, the "Attacking" animation will loop with no end.

    So what I tried was this:

    (Inverted) On "Attack" pressed - Player: Set "IsAttacking' to 0

    Value "IsAttacking" equal to 0 - Player: Set animation to "Standing"

    That results in the sprite flashing for a tick and nothing else happening. So my guess is that the "press key" only works for a single tick and so does the inverted version - so it tries to start the animation for a tick and immediately sets it back to 0.

    But I don't see how I'd set it otherwise. Help!

  • There's a check-box in the animation editor to turn looping on/off for an animation. Then you could use the "Is animation finished?" condition to check if the attacking animation is done playing. If it is, have the animation set back to standing.

  • Ah, thanks, I didn't know about that condition!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 10) That's a weird one: I created a textfield and while the text looks good in the layout editor, it looks awful at runtime. It has jaggies all over and is just not the same thing I get in the layout editor or in Photoshop, for that matter.

    Sampling is set to linear, text rendering is set to antialiased. ClearType looks even more horrible.

    Any way to fix this?

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