lapinchatware's Forum Posts

  • My game have an HighScores table. I get/set highscores on my server with Ajax request. On C2 previews it was working beautifully but it's not anymore on C3.

    Is there a way to allow Ajax request in previews?

    Thanks

  • How do I preview my project fullscreen when using C3 remote preview.

    I did try to add my app to my mobile home screen (iPhone7 and Nexus5):

    iPhone7->Safari->Share...->Add to Home Screen

    Nexus5->Chrome->(three dots)->Add to Home Screen

    This project is specificaly made for mobile.

    For some reasons "Request Fullscreen" doesn't work.

    On C2 this was working great. I'm sure it can be done in C3 but how?

    Thanks

  • I think you understood really well how it works. To answer your questions:

    • the Array is used to store the UID of each segment in order. This way it is possible to switch visibility state of specific section of the bar. This is where the magic reside.
    • gameData is used to keep data between layout switch. In this case the player HP.

    Since I posted this, I found another way to do it. I needed a round HP bar. This solution need only one sprite. This sprite could be any shape. This shape should be filled with a gradient from a solid color to transparency. Then you apply this effect to your sprite. You set "Smoothness" to 1 and "Flat Colors" to 1. By changing the "Threshold" parameter from 0 to 100, you should see the sprite gradually appear or disappear. Here's an example .capx

    The effect is not perfect but I haven't worked a lot on fine tuning this.

    The alpha threshold effect I used can be replace by 'vanilla' effect but I preferred the result with this one.

    To change the color of your sprite, you simply rotate the HUE with the effect "AdjustHSL".

    If you want to also move the "other side" of the bar, I guess you can simply rotate the sprite at the same time.

    I hope it is not to confusing.

  • At the end of this post I add a possible solution: post.

    Here is the .capx if you want: HPbar.capx. (note: I'm not the only author of this solution... read the thread).

    On a computer everything is nice(60FPS) but on mobile, it is more difficult. On my Nexus 5 this experiment alone run at 60FPS but when I include the bar in a real project, FPS depends on how high the bar resolution is. You will have to experiment.

  • I know it's an old thread but I think it will be useful for someone else. I solved the FPS and CPU usage issue. It's not perfect but it's way better now. The solution was simple: instead of destroying and creating instance each time there is an HP change, I figured it was easier to turn visible/invisible the HP bar pieces. It's easily configurable so you guys can experiment with different values. Have fun!

    Thanks to all of you for your work. Special thanks to zyblade, Jayjay and zenox98 (I sadly was not able to see/test others previous links).

    Enjoy.

    HPbar.capx

  • Well, you are right. Layers are for graphics. Events controls game mechanics and graphics. Events can also controls layers. That's why I was asking. In my specific situation, when I changed tabs, layers list was not always coherent with what it should have been. I believe It's only a minor bug since everything in my game is working well. If you don't encounter this thread specific situation everythings should be alright: layers are for layouts graphics.

    lennaert explained it well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ho yeah, it made some sense. It's working this way but in my specific case, the events sheet associated with my layout don't follow. But since I made some test in a test project and everything is fine, I believe that I'm in front of a minor bug.

    I think I will just live with it until my game don't work because of this... if it happens of course. Until then I'll continue to work as usual.

    Thank you for this information it was really useful.

    More I work with Construct 2, more I love it.

  • I have one layout with an associated events sheet. In the events sheet another sheet is included. Each sheet have three layers and the layout have four. Is it normal? I had the impression that layouts and their associated event sheet are suppose to have the same amount of layers.

    What if I try to get informations from a layer in an events sheet that only exist in the layout?

    Do I have to make sure that layouts and their sheets have the same layers?

    Is the layers are global or they belong to their respective events sheets and layouts?

    Hope someone can answer this.

    Thank you!

  • Yes exactly. My question is answered. It's good to know that I can trust and select UID from the editor. It easier.

    Again, thank you guys. I have a better understanding of those IDs.

  • I understand. I can pick the UID directly with instance.UID if I know there is only one instance of an object or selecting the first[0] instance with pick nth instance then save this instance UID in a variable. This way I don't hardcode UID and get the result I want without risking to load an unpredictable one.

    Good, I'm going back to work then.

    Thank you for your help!

  • Thank you!

    I did thinked about this when I was reading documentations but I read in this post a comment of Ashley about the unreliable state of UID. It was in 2011. Maybe since then things changes.

    Anyway, I tried it and it's working well! Until I found a better solution, if there is one, i'll keep my function as it is.

    If someone wants to know how I did: preStart3.capx

    Thank you blackhornet

  • Hello everyone, I was a ghost guess user for some times and I'm now a new and shiny registered user with a name. Today is the day of my first topic on this friendly forum.

    As my subject title state, I'm trying to pass an instance to a function.

    I did make an example of what I'm doing:preStart2.capx

    I want to make a function I can reuse in different layouts. (that is the point of a function, right?) I want to pass an instance(three in my case) of an object to the function so I can do stuff with this specific instance. The instance will not always be from the same object but they can be from the same family. The instance will be create at the beginning of the layout so it is not generated dynamically. I know already which object will use the function.

    I've already read about IID and UID:

    Those references I found are not what I want or maybe I did not understood what IID, UID and function can do for me.

    Hope I give enough details for you users.

    Thanks you to take a look at this.