Tryall's Forum Posts

  • 6 posts
  • Well, That not working with my test project. But with my main project it's the case.. Well, thank you

  • Still don't work... Only the 2 first objects are shooting...

    • For each "RedSprite"

    --- Has line of Sight to "BlueSprite"

    ------ Every 1.0 seconds // Shoot

    • For each "BlueSprite"

    --- Has line of Sight to "RedSprite"

    ------ Every 1.0 seconds // Shoot

  • Hello. I have a project with a lot of ship fight together (Not controlled by the player). So I made 2 ships. One blue, and one red. If a blue one as Line of Sight to a red one. He shoot. Same thing for the red one.

    But, Only one ship of the red and blue want to shot. I'am 100% sure that all the condition are verified for all the ship.

    So I made some test in a new projet. I created 2 sprites. One red and one blue. And copy/pasted the red one and the blue one 3 times (so 6 objects in the scene). And with the following events :

    • "Red Sprite" // has Line of sight to "Blue Sprite".

    ----- Every one second // Shoot

    • "Blue Sprite" // has Line of sight to "Red Sprite".

    ----- Every one second // Shoot

    But only one of the red sprite want to shot (The first instance I created of the red sprite). And only one of the blue sprite want to shot (The first instance too). And the 4 others don't do anything... I realy need your help. I'm totaly stuck with this...

    This is strange because in my main project, all the objects instance respond to others events (like start fighting the other ship if he see it, or not). I having trouble only with the shooting system. Can you help me please ?

  • I found ! Thank you for the timer behavior tips !

    The "How to" for who need the same thing (I don't put any screenshot or project file because i'm not at home, I just have the real "Potato Internet" here.)

    Create your stamina bar and a global variable named "Stamina". You can found some tutorial on the Internet for making a stamina bar who moved with your "Stamina" variable.

    I set the global variable "Stamina" to 100.

    My stamina bar have 4 behavior : The "Pin" behavior because my stamina bar follow the player. The "Timer" behavior for the little timing before it start regenerating. And two "Fade" behavior, one for the Fade In, the other one for the fade out (I want my bar to be invisible after 1.5 seconds if the stamina is full).

    For the two "Fade" behavior, name the first one "Fade_In" with the settings : "Yes", "0.5", "0", "0", "No". And the other one named "Fade_Out" with the settings : "No", "0", "1", "1", "After fade out".

    And the code :

    If Keybord "Maj" is down, AND if "Stamina" over 0, AND if the speed of the player is under the walk speed. -----> Set the player speed to "run speed", subtract the stamina (0.7 for me). stop the timer (inser your timer tag, can be anything, that doesn't matter), and desactivate the "Start_Stamina_Regen" group (we gonna create it later).

    If Keybord "Maj" is released -----> Set player speed to "walk speed".

    If "Stamina" (global variable) is under 100, AND the speed of the player is under the "run speed" -----> Start the timer of the stamina bar for 3 seconds, "Once" with the tag "Stamina_Regen"

    If "On Timer "Stamina_Regen"" condition is true ----> set group "Start_Stamina_Regen" activated.

    CREATE A NEW GROUP named "Start_Stamina_Regen" (activated by default).

    put in the new group : : Every 0.05 seconds, add 4 to "Stamina" (global variable).

    (in no group this time) If "Stamina" (global variable) is equal or over 100 -----> Set "Stamina" to 100, set group "Start_Stamina_Regen" to deactivated, Call the function "Stamina_Bar_Fadeout" (we gonna create the function later). set group "If_StaminaUnder100" to activated (we gonna create the group later).

    If "Stamina" (global variable) is under 0 ------> Set "Stamina" to 0, set the player speed to "Walk speed".

    CREATE A NEW GROUP named "If_StaminaUnder100"

    put in it : if "Stamina" under 100 ------> Call function "Stamina_Bar_Start" (we gonna create the function later), and set the group "If_StaminaUnder100" to deactivated.

    (in no group this time) : on function "Stamina_Bar_Start" ----> Create the stamina bar were you want with your settings, you can Pin it on other objects like me if you want. and Start the "Fade_In" behavior.

    On function "Stamina_Bar_FadeOut" -----> Start the "Fade_Out" behavior.

    Sorry for the long post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the tips, I totaly forgot about the Timer behavior.

    I successfully made the timer, from 0 to 3, If the player run again the Timer restart like I want. All is perfect, except I don't know how to start the stamina regeneration when the timer made his 3 seconds. They are no condition trigger ? How can I do ?

  • Hello, First I am sorry for my bad english, I do my best <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    I try to make a stamina bar. If the player run, he loose his stamina. If he don't run for 3 seconds, his stamina regenerate. But I have some issues with this 3 seconds timer... Here is my code :

    imgur.com/a/kOtBi

    If Maj is pressed, Stamina over 0, and player is not stationary ---> The player run (100 is the walking speed). And he loose stamina.

    imgur.com/a/yP41A

    And here is where i am stuck. I try to do : If the stamina is under 100 (the maximal level) and the player don't have the running speed ---> Wait 3 second before the stamina start regenerate.

    But I want when the player start another action that consume stamina, the 3 second timer reset and restart at 3 second when this action is over. for finally regenerate the stamina at his maximum while the player don't re-consume his stamina.

    With the actual code, If the player run while the stamina start regenerate, the stamina keep regenerating immediately after the player stop running without waiting 3 seconds.

    Can you help me with this ? i'm realy stuck...

  • 6 posts