InDWrekt's Forum Posts

  • You can either store the information in a format that the user can't easily figure out or encrypt the information.

    To save in a format the player can't easily figure out, you would convert the data prior to saving to something like a bit stream. A bit stream is a line of 0s and 1s built from converting your information to bits, zero padding each piece so the stream has each piece of information in exactly the same location, then appending all together so it is one long line. You have to parse and convert this back to the actually data when the file is loaded. This type of save is still able to be edited by more clever users but it will be harder.

    Encryption may be easier if you use a plugin. There are couple encryption plugins. I haven't tried them but they may be what you are looking for. You simply run the encrypt action when saving. Then decrypt when loading. This will make the file nearly impossible to modify and if the user tries to edit it, it will most likely corrupt the file. The only way to see and change the file information is with the correct encryption key and algorithm.

  • I can see why you are struggling with this. There really isn't an easy way to reference a global variable indirectly. There is 1 way I was able to come up with for you however. Try this out:

    drive.google.com/file/d/1HXei-9dZKNK7auwO9zIhSobVDIKQ4U_y/view

    I believe this will do what you are asking for. However, it could very quickly get out of hand if you have a bunch of global variables. You need 1 event per global you want this function to change.

    On a side note, why are you using global variables for this? Do you need the values to persist across multiple layouts? I only ask because I see many newer users using global variables like they were local variables. If these values don't really need to be persisted from 1 layout to the next, you could cut down the number of events necessary. For instance, instead of using globals, you could store the values in an array. Then, you would pass the index of the value you want to modify instead of the name of the variable. This would take the above example from 4 events in the function to just 1. In fact, this would even work if you do need these values to be persisted because the array is considered global if I remember right.

  • Sorry, you're right, I didn't notice this was in the Construct 2 forum. I just saw it under the unanswered questions.

    In Construct 2, you would do something like this:

    -> CurDate: Set text to left(Browser.ExecJS("Date()"), 24)

    This gives this result for me right now:

    Sat Dec 12 2020 09:30:49

    I believe the time is displayed in 24 hour format so instead of am/pm, you get a value between 0 and 23. If you need the date formatted exactly the way it is in your post, you will either have to modify it yourself or see if there is a plugin that will do it for you. I believe there is a pretty good date plugin from RexRainbow you could look at.

  • I pulled down your project and this is what is going on. Your background layer is set to 0 parallax which means no matter the position of the camera, that layer will always be aligned to the same position of the camera. When you zoom in, the mountains aren't disappearing, the layer is just scaling up to where they are below the visible area. In the attached image, the red box shows the part of the background that is visible when zoomed in.

  • -> CurDate: Set text to Date.ToDateString(Date.Now) & " " & Date.ToLocaleTimeString(Date.Now)

    This is how to do it using Constructs built in Date object.

  • Just a thought that could make this a little easier. Instead of storing the gestures as a group of sprites, you could use a spritefont object. Then, testing if the gesture is the next one in the group would look like this:

    + System: left(Gestures.Text, 1) = Functions.GetGesture

    In this example, Gestures is the spritefont object and the GetGesture function returns a single character string assigned to the specific gesture. I have attached an example using this method. It isn't using the plugin you are using (I decided to build my own gesture code just to see if I could) but you can see how the above event works in here.

    C2 version:

    drive.google.com/file/d/1osFg_AGLOCHDS1Fa3bInhgBSz17B7-Eh/view

    C3 version:

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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)

  • 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.