Lncredible's Recent Forum Activity

  • Not sure what you mean but maybe this:

    Put your check for Family.Health OUTSIDE of collision checks. You want it to run all the time, not just when your objects collide.

  • Hi,

    Sounds like you've done everything right. Can you verify that the explosion sets their health to "0" in the debugging mode?

    Family.Health <= 0

    ____ Destroy

    That should be enough to identify which unit's health has become <= and remove it. Can you attach your project?

  • Hi,

    You could add a short cooldown timer so that only the first tap is registered.

    Add the Timer behaviour to your object.

    Add a number Instance variable to your object called "Firing" set to 0

    "On Tap"

    AND

    "Instance.Firing = 0"

    ____Start Timer for 0.2 seconds tag "Cooldown"

    ____Set instance.Firing to 1

    ____Call Function "Fire!"

    On Timer "Cooldown"

    ____Set instance.Firing to 0

    This will stop your player tapping twice in quick succession (such as a two-fingered tap) as the first tap immediately sets Instance.Firing to 1. However, the biggest limitation here is how fast you allow your player to shoot. You can adjust the timer to accommodate this.

  • Hi,

    Firstly check out the manual: scirra.com/manual/134/performance-tips

    and of course: scirra.com/blog/83/optimisa ... -your-time

    If it is a single moment where you are experiencing a lot of "lag" then you might be in luck - start the game in Debug mode and then use the debugging tools to see how many Collision checks, poly checks, are running at the time of your event.

    If you can accurately reproduce the performance problem then you know EXACTLY where it happens. Take a copy of your game then try to fix it step-by-step by adjusting things.

  • Try Construct 3

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

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

    Like you stated the "sprite" method is a good one. If you create a health bar sprite with six frames then you can accomplish this easily:

    (0) Red Orange Yellow GreenYellow Green

    (1) Red Orange Yellow GreenYellow black

    (2) Red Orange Yellow black black

    (3) Red Orange black black black

    (4) Red black black black black

    (5) black black black black black (dead)

    Default frame will be (0) and then you can iterate through the remaining frames each time it takes damage or back again when it heals.

    Also, you can create events that start on the following:

    Monster.AnimationFrame = 2

    Start Phase 2

    Monster.AnimationFrrame = 4

    Start Phase 3

    N.b. Just remember to set the Animation speed to 0 for the healthbar, or it will iterate through the steps itself! You want to be in full control of it.

  • Hi,

    So you have suggested that "time" is the reason why the dash would stop, not something like stamina. Perhaps it is best to use a Counter to control this behaviour.

    1) First, add an "instance variable" to the player called MaxDash.

    2) To your existing function "Player_Dash" you could add "Add +1 to MaxDash". Since the function is being called 60 times a second already, giving you smooth movement, you'll find that MaxDash goes up by 60 every second too.

    3) Add a "Condition" to your "Player_Dash" function that changes the code to:

    On Player_Dash

    If Max_Dash <180

    Set speed to 500

    if Max_Dash >= 120

    Set speed to 180

    Simulate movement Right

    This way your function still operates but the player will find that their speed reverts back to 180 after 2 seconds. To reset Max_Dash you should add a line that says On "D" pressed set Max_Dash = 0. So, D being pressed resets it, D being held doesn't.

  • I sent you a private message

    Hello,

    I'm not able to reply until I've earned 500 forum rep! Contact me on FB or Twitter via my profile if you like.

    Cheers

  • Since I know each sprite's combination, is this still the best way?

    It remains best practice to write functions that are capable of checking any number of combinations. Not necessarily because it's best to have that flexibility, but more to do with being concise - one function to handle ALL combinations is good. Creating 9 separate chunks of code to deal with each combination = repetitive.

    The function can also be used, as I said before, be more granular about how you allocate points, or judge failure. If you are having any trouble writing out something similar to my first suggestion I could do a mockup in Construct 2 for you to look at.

  • Hi,

    It depends what you want to achieve. I would say you need to make it visually / mechanically distinct. So, you know the "stamina" part works, but you haven't revealed what is NOT working. I assume you just haven't managed to change the "speed" of your sprite with the platform behaviour. What have you tried? (post a screenshot of your logic)

    I would be tempted to disable player input as soon as the "Boost" happens (triggering a timer) and then speed the player up, remove gravity and deceleration, and then re-enable them afterwards when the timer expires.. Perhaps something like this:

    You will need the "Timer" behaviour on your Player object for this, and a new instance variable of type text called "Boosting", with default value "0".

    Player.Boosting = "0" # Can't be run unless Player.Boosting is set to "0"

    Event - "Q" is pressed

    Set Group Active - "Movement" - disabled. # Disable your player movement group.

    Start Timer for 1 second with tag "boost" # The duration of the boost.

    Set Maximum Speed = 3x your normal speed

    Set Gravity = 0

    Set Deceleration = 0

    Set Player.Boosting = "Left"

    Set Player.Animation = "Cool.Boost.Animation"

    Event - "E" is pressed

    Set Group Active - "Movement" - disabled. # Disable your player movement group.

    Start Timer for 1 second with tag "boost" # The duration of the boost.

    Set Maximum Speed = 3x your normal speed

    Set Gravity = 0

    Set Deceleration = 0

    Set Player.Boosting = "Right"

    Set Player.Animation = "Cool.Boost.Animation"

    Player.Boosting =/= "0" # When Player.Boosting is not "0" it simulates movement left or right.

    Every Tick

    Player.Boosting = "Left"

    Simulate Platform Movement "Left"

    Player.Boosting = "Right"

    Simulate Platform Movement "Right"

    Player.On Timer "Boost"

    Set Group Active - "Movement" - enabled. # Re-enable player's movement group.

    Set Player.Boosting = "0"

    Set Maximum Speed = Default # what it was before the boost!

    Set Gravity = Default

    Set Deceleration = Default

    Set Player.Animation = "Default"

    I can do a mockup if you need it. Let me know if this helps!

  • Hi,

    I'm not exactly sure what you are after, but here is a way that you can increase the speed of an object over time using Events. Depending on whether you have chosen one of the pre-build movement modules such as Platform, Bullet, or Pathfinding, you can increment speed upwards using an "every x seconds" event:

    E.g.

    VariableSpeed = 0

    Every X Seconds

    Set VariableSpeed = Object.Bullet.Speed ## Takes the old speed from the object and stores it in the variable VariableSpeed

    Add 1 to VariableSpeed ## Adds 1 to VariableSpeed

    Set Object.Bullet.Speed = VariableSpeed ## Sets the object's new speed to the variable VariableSpeed

    end

  • Hi there. You'd probably want a function that checks all 8 for input every time rather than having "set" combinations. This allows you the flexibility to include any combination you want in future. The Function could be called with 8 parameters which map to your button combination, such as "10001000" in the example below:

    Variable "FailState" = 0

    ## You need a variable to judge whether or not the player has failed to do the correct combination. Any of the combination checks can register a fail which then gets passed to the next function which allocates points.

    "Combination" on collision with "JudgementRow"

    Run Once

    Call function "Judgement" (1,0,0,0,1,0,0,0)

    Function "Judgement"

    param0 = 1

    param1 = 0

    param2 = 0

    param3 = 0

    param4 = 1

    param5 = 0

    param6 = 0

    param7 = 0

    {

    set "FailState" to 0 ## Resetting the variable so the player doesn't inherit the result from last time.

    if function.param(0) = 1

    if button1 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(1) = 1

    if button2 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(2) = 1

    if button3 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(3) = 1

    if button4 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(4) = 1

    if button5 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(5) = 1

    if button6 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(6) = 1

    if button7 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    if function.param(7) = 1

    if button8 is NOT pressed

    set "FailState" to 1 ## The player has failed the combination.

    Call Function Points(FailState) # Passing Failstate to the Points function, which can be used to either subtract or remove points based on your gameplay logic.

    }

    If you wanted to improve this, you might consider the following:

    1) The player has failed the combination completely (all three buttons missed) - they get 0 points.

    2) The player has failed the combination by missing one of the three buttons - they should get SOME points.

    3) The player has passed the combination - they should get all the points.

    If you changed the variable above to "add +1" (instead of "set to 1") for each incorrect check then pass that number to the "Points", you can judge the degree of their success and failure.

  • Hi - when is this happening - in preview mode?

    I would suggest trying another browser, but also trying an old version of you game (do you have some backups?).

Lncredible's avatar

Lncredible

Member since 10 Sep, 2014

None one is following Lncredible yet!

Connect with Lncredible

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies