InDWrekt's Recent Forum Activity

  • If you put the health bar and elf into a container, a health bar will always spawn with an elf. Then, on creation, do what dop2000 is saying and pin or add the health bar as a child of the elf. I built an example that uses the container for a different forum question:

    drive.google.com/file/d/1vObtjdJppTivblySf-rn0Vx4bUH2fYTn/view

    Most of the example code is unnecessary but take a look at the hunger and thirst bars and how they are related to the Creature.

  • In a client server setup, the client shouldn't be doing physics calculations. Only the server should. The server is the system that decides where every object is and how they are interacting with each other. On the client side, you may need to extrapolate player positions given their current state and position but this should really be a minor calculation to keep the client as close to up to date as possible while waiting for the server to update it. The client should have all behaviors disabled and should send all control events to the server.

  • It's difficult to style form controls, and there are many other problems with them.

    Use TiledBackground object instead, it's very easy - just change its width.

    On every tick -> Bar Set width to 300*(Player.health/100)

    where 300 is the maximum width, and 100 is the maximum health.

    Here is another example:

    https://howtoconstructdemos.com/simple-healthbar/

    LOL, just beat me to it.

  • The built in progress bar is very 1 dimensional. To be able to change it's style, you need to have a pretty good grasp of web styling with css. It is easier to create your own progress bar using sprites. Check out this example.

    drive.google.com/file/d/1jKxObimMcmSBK_Wh8wfvlEMFanxho76q/view

    To set the width of the progress bar, you use the following equation:

    FullWidthOfBar * (CurrentValue / MaxValue)

    So if your progress bar is 300 pixels wide and it is tracking life where the max life is 50 and the current life is 40:

    300 * (40 / 50)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Take a look at this tutorial.

    youtube.com/watch

  • Behaviors have an enabled property. All you need to do is, set the initially enabled to false. Then you can use an action to set it enabled or disabled depending on the value of your checkbox. You don't even need the boolean.

  • I took a look at your code and noticed you are using functions and for each statements. I couldn't help but think this could be easier with a state machine.

    For a state machine, you need to give your objects a state and update the state according to their needs. For example, a bug would start at an idle state. Then, when they need to eat, they enter a searching for food state. When they find food, they enter an eating state, etc...

    I threw together a quick example that shows the principle in action. Hopefully it gets you closer to completing your project.

    drive.google.com/file/d/1vObtjdJppTivblySf-rn0Vx4bUH2fYTn/view

  • Redownload the project. I made some modifications to it.

  • Try this out.

    drive.google.com/file/d/1dMQx8tQNF09r4DNKZClDx661RnffwLLk/view

    Here is what I did:

    Took out 1 of each of the indicators.

    Stretched the indicators so it is on both sides of the box.

    Removed 1 of each of the text objects and just set the text according to the push state.

    Added the box, indicator and text all to a container.

    With them in a container, whenever 1 item from the container is selected, all items from the container are selected. This is what ensures that the child relations are set properly in your code. Personally, I would remove all the child code and just pin the objects to the box. It would drastically cut down the actions but it works just fine this way.

  • 1 - Just set the preview panel objects from the instance variables on the Highlight objects.

    2 - The wrong answer is exactly the same as the right answer just with a not equals. You will also want to only allow it to trigger once while true.

    3 - DON'T DELETE, just move them off the screen. If you take a look at my example, the highlights start off the screen and there is an on screen check.

    4 - The animal text event is exactly the same as the animal event. I am not sure what your question is. If you can do the one, you can do the other.

    5 - In the on-click event, just add a condition comparing the opacity = 100.

    6 - Just increment the values in the events where you play the sounds. Also, if these variables are specific to the level, (meaning the count of tries is reset on each level) I would suggest not using global variables. Instead, add an instance variable to one of the objects on the layout. I would put it on the text object that displays the value. I make this suggestion because global variables are remembered between layouts so you will have to clear them on start of each layout.

    I hope this gets you what you need and good luck with your project.

  • I think this example should give you all you need. Take a look.

    drive.google.com/file/d/1INg7SXrc4XT3ew7nmUkOuTFpHGy0xdIU/view

  • When you export to android, there is an option to hide the status bar. Make sure you have that checked.

InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies