Ribis's Forum Posts

  • dop2000 Thank you for the reply. I always have problems with manipulating arrays. From the original example which works, the JSON structure looks a little bit different from the nftUser.json.

    The raids is set on the Json, which contains the array taken from the the nftUser.json file. So, I guessed that should be set as it was.

    I tried your suggestions, but I can't make it work. I would be happy if someone could show how the events should be. I will keep trying. Thank you

  • Hello there,

    I have a question regarding the manipulation of a JSON. I took the example from this topic: https://www.construct.net/en/forum/construct-3/scripting-51/parse-json-objects-return-149689

    Here the example I'm working on it, I did several tests but I can't make it work as I want: https://umbriadesign.it/json-test.c3p

    Basically, I need to check if the following json contains a specific id item from a string list. If the json file contains it, then I need to retrieve the name or other parameters of the following id item, if not, just mark as not found.

    I'm working on it. If I make it work I will share it here. Help is appreciate.

    Thank you

    Tagged:

  • Hi Ashley, Thank you for the reply. I was able to set the global variable in the event sheet from script! Thanks again

  • Ashley Thank you for the reply.

    I added the following script which works if I run it on the Construct 3 event sheet adding the script as an action: https://www.construct.net/en/forum/construct-3/scripting-51/set-global-variable-using-149803

    I guess I'm missing something here. If I add the same code on a script.js I get the undefined variable. How I can access or set the global variables in Construct3 directly using a js file? Shouldn't the runtime already be defined?

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello there,

    I'm trying to set a global variable in construct 3 using Javascript (in a script.js file)

    The code looks like this:

    async function get() {
    let url = "https://domain.com/myjsonfile"
    let obj = await (await fetch(url)).json();
    console.log(obj);
    runtime.globalVars.Variable1= obj;
    }
    var tags = get();

    This code log the json in the console, however, when I try to set the Variable1 it gives me the following error in the console:

    Uncaught (in promise) ReferenceError: runtime is not defined

    Note that the function is launched as soon someone click a button in Construct3. I tried several ways but I'm not able to retrieve it.

    The idea is to retrieve the json file using the javascript, then set a global variable and push it to the json plugin.

    Thank you

  • DiegoM Awesome, it works great! Thank you.

  • Is anyone working on this? If someone can work and make a script/plugin that interact with the meta mask plugin to check the nft owned and check the balance I'm ready to pay for it :)

    DiegoM Would you mind to post the projects that loads the web3.js?

    Thank you

  • Hello there,

    I found two Construct 3 projects which generate a pdf. Everything works well, however, I would like to attach a snapshot on the pdf page.

    I have added the script in myPDF.js increatePDF.c3p:

    //import image
    var imgData= runtime.globalVars.imageURLstring;
    doc.addImage(imgData, 'PNG', 15, 40, 180, 180);
    

    However, this doesn't work. I'm not sure what I'm doing wrong. I'm trying to add the snapshot which is in PrintToPDF-1.c3p to createPDF.c3p.

    createPDF.c3p - Here the file that generate the file using jspdf

    This is the other example that prints a snapshot by opening the print option. I would need to invoke the download as soon the user press the button.

    PrintToPDF-1.c3p - Here the file that invoke the pdf print from the snapshot

    If anyone has an example where I can generate a pdf from a snapshot, even better if I can add text (as in createPDF.c3p) on it and invoke the download as soon the user press the button would be great.

    Thank you!

    Tagged:

  • I'm sure there are better ways to do it. The first thing I can think is that you would need two variables:

    - detect in real time which button is pressed (left or right)

    - delayed variable that check evert 0.1 second in which direction the player walk (if player is moving, and right is pressed, then is right. Or, if the player is moving, and is not mirrored, then is right...etc.)

    Then, you compare these two variables to detect when the player changes direction.

    If real time variable is left (the button is being pressed) and the delayed variable is right (because it takes 0.1 sec to turn left) then you know that the player is turning left from the right position. At this point, you can make a boolean which is true, to the action you need to do, and set the boolean back as false. Of course, while the boolean is active you can disable the two actions I described above. When the animation of the player ends, set the boolean to false.

  • > on layout change set float chaseDistance to distance(player.x,player.y,enemy.x.enemy.y)

    >

    > Every seconds if bool enemyNotSpawned = true subtract enemySpeed from chaseDistance

    >

    > if chaseDistance < 0 spawn Enemy

    >

    >

    > This should work even with layout changes before the enemy spawned again.

    >

    > Or do you want to achive something like this:

    > layoutA>layoutB>LayoutA Enemy is still in layoutA running to layoutB?

    I studied this example and was able to make the enemy's appearance latency more realistic.

    However, the problem of the enemy not staying in the same "room" when I exit and come back is still a headache. I guess I will look into arrays to see if I can find a solution for that. Thanks fedca for helping me out.

    If anyone has suggestions for my latter problem, it'd be greatly appreciated.

    Yes, you could use an array, especially if you use multiple enemy.

    I can see it something like this:

    Add a number to the layouts (ex: level_0_0, level_0_1, level_0_2...etc)

    Calculate the width layout and store it in an array ( 3000,2500,3000...etc)

    On the monster, I think there is a behavior where you can keep the variable as you change the layout. Add that behavior, and make a variable which store in which layout the monster is, same with the distance X player, and a logic global distance.

    Now, the logic would be, if monster is on level 0_0 and you are on level 0_2, since you have the total width of the layout, and the last distance captured between the player and the monster, you can calculate the logic distance between the player and the enemy. If the player is in a greater number layout (you can compare it using actual layout name and monster layout using tokenat), you know if you need to add, or substract the distance. Then, knowing each width layout, you are able to understand where the enemy is. For example, while adding the number to the logic distance, if the enemy falls on 4000 distance, you know that is on level_0_1 and you can place the enemy as soon you get in that level in the exact place as soon the enemy was moving.

    This would allow you to make a logic which says: if logic global distance is grater than 12000 (let's say, you pass 5 layouts), then stop the enemy. Knowing where the enemy is, and the global distance you can easily spawn the enemy when you get back to that layout. You can also store all of this in the array, where each enemy gets it's own row, or simply store it on the sprite instance. Array is helpful to save the progress and then load it easily.

  • As suggested by Ashley, I have added it as a suggestion here: https://construct3-21h2.ideas.aha.io/ideas/C321H2-I-142

    Upvote this feature if you think this will be a game-changer. I think anyone who makes a 2d game will use this feature on a regular basis to add new design elements to the game.

    Thanks

  • I'm not sure how useful it is for me to keep repeating this, but I would love to do all these features. But we have limited resources and we have to prioritise. No matter what priorities we choose, some people will be disappointed.

    Many people are passionately arguing that we should do even more 3D features. I'm not sure we will; Construct remains a primarily 2D tool and we're not aiming to make it anywhere near as capable as 3D tools like Unity. So we will probably go back to focusing on 2D and other features for the time being.

    If you use 3D features, naturally you want more 3D features. If you use 2D features, naturally you want more 2D features. If you use data storage plugins naturally you want more data storage features. And so on. One more time: I'd love to do it all, but sadly we are bound by the laws of physics, and have to make choices one way or another.

    Ashley

    Yes, but as you stated Construct 3 is a primary 2d tool to make games/software in 2d. I have been here since 2012 I believe, and I have invested my time here because I believe that soon this tool will allow us to publish games quickly that would work amazingly on any platform (web apps are the future and they are already here). It is already possible and I have 2 apps in beta, that are working fine, but my time and frustration regarding the creation of the level are getting more and more frustrating. Then, when I check the updates I'm seeing 3d features which are not nearby helpful as allowing us to design our platform on the layout (still, Construct3 is a 2d tool, if it becomes a 3d one I will just move to Unity). I choose Construct3 because I need to develop only 2d games.

    My concern on seeing these 3d features is that these will take time to the real important features that Scirra could focus on working on. Make a better dev experience when making games in 2d. Devs who want to use 3d need to use another engine if they want to make a game in 3d. There is no way that a 3d game will run smoothly on the mobile in the web view. I have done a ton of experiments to make my games run smoothly. Still, I don't see how someone can make a 3d game using a 2d layout.

    Jase00

    Yes, that is one of my main concerns. There are several engines that have visual scripting that make only 3d games and export for android/ios. They cost more money, I have no idea why someone would want 3d features in an amazing tool that works perfectly fine as it is now. 3d Addition just add more complicate stuff in a software that should be kept simple as it is.

    Also, I don't say to focus on the layout editor, in fact, I think is one of the best I have ever used. I used the first game editor in the 98 with klick & Play. And so far, Construct 3 is the best one. What I am asking is a simple feature that uses mesh editor to generate the terrain much easier, so when we develop 2d games, we can use few textures the generate the whole level, instead of being forced to use hundreds if not thousands of objects or stick with the tilemap grid. This would allow us to design the level in the editor, and I bet it will be less resource-heavy for the mobile phone when it's rendered.

  • The community response to the new 3D features has been one of the most excited and overwhelmingly positive responses to anything we've ever done.

    Lots of users want different things from Construct, and in some cases different customers want contradictory things. We have to balance what thousands of people want. Unfortunately it's just impossible to make absolutely everyone happy, but we do our best as a small team with limited resources to aim for what will make the biggest impact for the most people.

    That's not to say anyone's ideas aren't good ideas - this sounds good and it would be great to have it. But we have to balance that with literally hundreds, if not thousands, of other ideas, and in particular large and complex projects like the one you suggested appears to be are particularly tough. We tend to focus on the things we see lots of customers constantly requesting.

    Ashley Yes, I understand that is hard to make everyone happy. I'm not expecting that the Scirra Team can implement every feature that every user requests, good or bad.

    Most excited doesn't always mean most beneficial for Construct3. Today, I can't still see how the 3d feature can be a benefit for a user who wants to publish and make money from a game. As I stated above, there is plenty of 3d software. If someone wants to build up a 3d game, they need to change the engine if they want to make something real that can be published and run smoothly. If they want to experiment and have fun, then it's another story. My goal using Construct3 is to make professional good looking 2d games that can be published and make money from them, which is still possible with a lot of hard work and a lot of limitations.

    I wanted to rise a problem that Construct3 has: it is pretty limited when designing a 2d platform since we are limited on tilemaps and sprites/tiled background, which means that is frustrating as I talk as a graphic designer who wants to design level as I would paint. If you want to make a nice-looking level, you need to use hundreds or thousands of objects which is not convenient and takes up a lot of resources.

    Construct3 still doesn't allow a nice workflow when it's time to design a level. This means that I am spending more time using other software to make what Construct3 could do much faster if a sprite shape was there.

    So, it's hard for me to believe that right now the Scirra team is focusing on the 3d features when this tool was made exclusively for 2d games, which I choose for this reason. I'm curious to know how many devs are going to integrate the 3d feature in a 2d game. If making the sprite shape is too hard, then it's another story.

    I will keep supporting Construct3 even if I won't see this feature realized. I just suggest focusing on the 2d features that would allow us to make our life easier when designing a game/level.

    Just saying, sprite shape on Construct 3 would be an app killer. You will attract hundreds if not thousands of new client if show a workflow demo on how easy is to design a good looking level.

  • I'd love to do it, but we're a small team with limited resources, and we receive far, far more feature requests than we could possibly do. Please be patient!

    Hi Ashley I appreciate your reply, but I don't understand why focusing on 3d features when this tool was made to make mainly software 2d.

    Is there anyone who is developing 3d games using construct3? I mean, there is plenty of software out there that allows us to make 3d games with much more additional features since they were made to make 3d games with a 3d editor, and now they don't even require coding skills since some of these tools implement visual scripting which is similar to Construct3.

    I don't understand these people craving for 3d when phones can barely run 2d games if not developed well (Android phones, which have 72% of the market share). Also, the 3d feature can't even really be implemented on a realistic development side. It's cool for experimenting stuff. I tried one of the 3d demos on the phone and it can't run even smoother. Using a 2d tool with a 2d view for making 3d games doesn't make any sense in my opinion and it overcomplicates a tool that should be kept simple.

    The feature I am requesting focuses mainly on 2d development, which should boost up Construct 3 a lot. We still need to design our level using tilemaps (which are mostly for pixelated games) or rely on our system to make a decent level design approach. I guarantee you that if you can develop a similar feature as shown in the Unity Sprite Shape, all the users developing 2d games will benefit from it.

    Also, I'm talking as a Graphic Designer (and I'm also a software developer), which I would prefer to have 2d tools that would allow me to design a level in a better artistic approach. Most people using Construct3 are those who don't have the skills or don't have time to use more sophisticated software.

    I will be willing to donate or pay money to see this feature done.

    These are my 2 cents.

  • We're planning to look in to developing an editor feature for this.

    Ashley

    I love the new 3d features. However, I'm kind of disappointing seeing that a tool made for making 2d games is still not supporting this vital feature.

    Game running on 2016 devices still have lags running 2d games (Mostly Android), I can't imagine making a 3d game.

    As a hobbyist, making levels with the method I explained above saves time, however, it's hardware-consuming and the level design might get confusing. The game runs smoothly on the iPhone 6 which is good, but I feel this workaround makes the leved design over complicated.

    Is there any plan to introduce this feature, especially now that we have the mesh distortion in an editor? This feature would literally change the level design on any platform 2d.

    Thank you