InDWrekt's Recent Forum Activity

  • In my opinion, the easiest way to do this is with an array containing the animation names. When the game starts, you create the array and fill it. At the start of each round, you pick 3 random items from the array and set the text and image objects from them, then remove them from the array.

    I'm trying to make this matching game as an endless one...

    ...//probably 100 different animation

    I just want to point out, if you have 100 animations, showing 6 at a time and don't ever want an image to appear more than once, this project won't be an "endless one." The most levels the player will be able to play is 17. For an endless game, I would suggest not having the requirement that an image not show more than once. Since the images are chosen randomly, it is very unlikely that an image will appear right after it already has. Statistically, with a high number of images, it should be a while before you see the same image again (with these numbers, an image should show 1 time in 17 rounds).

  • In this image, I modified the tap ColorName action. It is now an on tap action which clears the color of the text with a subevent picking the tapped text object and sets its font size and color. In this version I am also using a global variable instead of the highlights variable.

    As for your comment:

    InDWrekt ...

    (I know "ColorNameHighlight" is kinda compulsory, so I made it invisible on the startup)

    Please help. Thank you.

    Nothing in the code I sent you is "compulsory." You can do everything I showed you many different ways. I try to emphasize this to newer Construct users. Nothing I show you is "The right way." It's just ONE way.

    I have modified the original project. There are now 2 different event sheets. The first layout is using the new event sheet. Instead of using the highlights, I added 2 instance variables to the TriesCountLabel that hold the last chosen color and name. I scale up the selected text and color squares and change the color of the text object. The new version still keeps score the same way, disables colors and names that have been correctly selected and continues to the next level when all 3 colors are chosen.

    Remember, there are many different paths that lead to the same result. The most important thing for you, is to learn the tool and decide which path works best for your needs.

    Good luck with your project.

  • Really!?

    local variables constantly reset!? Do you know the logic of why this is so?

    this makes them rather limited and forces me to use global when there isn't really a need for it to be global other than this weird limitation...

    mutajon, to answer why; in programming, a local variable is a variable that only exists at the time a method runs. Each time the program calls the method, the variable gets created and when the method ends, the variable gets destroyed. The variable is "local" to the method. Every tick in construct, the actions and events are run as separate instances. In essence, the system is calling each of these actions like methods which causes a local instance of the variables to be created then.

    I hope that helps you understand these local variables a little better.

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

  • Try Construct 3

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

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

InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

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

18/44
How to earn trophies