lapinchatware's Recent Forum Activity

  • Of course You need to prepare these things:

    - a database on your server.

    • some scripts on your server to read/write scores
    • a simple interface in C2/C3

    -=WARNING=- I did not implement something fancy, it's fairly simple so there is some security stuff to address. I've cleared some basic consideration about this security, but I definitely did not cover everything. I'm not an expert. It's also important to know that someone wise enough can definitely inject score in the database without playing the game. So, you've been warned. -=/WARNING=-

    Database

    You need a place to record your scores.

    • Create your database. (I personally did it through my CPanel.)
    • Create a table. (I did it manually with PHPMyAdmin). Mine have four columns : id, section, name, score.
    • Give your DB a strong password.

    PHP

    Here are the files I'm using. I will not explain them, if you don't know how it works, you will have to do some research. But basically, in each text file, replace the DB username, password, DB name and table name with your own. Those files can be placed anywhere in your project files export. Just take note of where you put them.

    PHP files

    Using this setup in C2/C3

    Here's a basic capx exemple: exemple

    NOTE: I haven't test this capx, but it should work.

    I hope it helps you. Have fun.

  • Yes, you are right. This is a browser limitation but when you add your web app to your home screen on your mobile, the application goes fullscreen right away when requested through code. Well, it's the expected behaviour.

    Yes, it's true, when you build your app and run it as a normal mobile application, everything works great. But an advantage of Construct(2/3) is the opportunity to preview your project without compiling/wrapping within a native mobile application.

    So we are back at the original problem: When using C3 preview on mobile, requesting fullscreen at start of layout doesn't work. But when previewing on mobile from C2, requesting fullscreen at start of layout do work. I did some test with a barebone capx in C2 and C3 and here are the results:

    iPhone/Nexus5 - C3:

    iPhone C3 Preview Screenshot

    Nexus5 C3 Preview Screenshot

    iPhone/Nexus5 - C2:

    iPhone C2 Preview Screenshot

    Nexus5 C2 Preview Screenshot

    Project files:

    Construct3 file

    Construct2 file

    Please note that both file contains exactly the same code and have exactly the same settings.

    There is a difference between C2 and C3 previewing results.

    Now, how can we solve this? is it possible with C3 right now? Do I have to report this as a bug?

    Thanks you dop2000 for your help by the way. I appreciate it.

  • If I understand well, I need to put a debug button in my project to get my app to request full screen. I don't like this idea.

    In C2, I was able to request full screen without this kind of work around after adding my app to the home screen. There is technically no reasons for this behaviour not to exist when using C3 since both previews are based on the same technology.

    Is it a bug then?

  • 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

  • Try Construct 3

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

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

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

lapinchatware's avatar

lapinchatware

Member since 25 Jun, 2015

None one is following lapinchatware yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies