brendanpoke's Recent Forum Activity

  • The canvas is rotating around the top left corner. You can change that in the properties to be centered, but you’d also need to move it by half the width and height when positioning it.

    But I can't do it dynamically via event.

    I'm currently thinking that this isn't a possible solution...

    it's easier to create clippings of all the sprites and create a new "metal parts" sprite and create it every time a spaceship, ufo etc... is destroyed...

    and every time I insert a new type of space enemy into the game, I insert a new animation to the "metal parts" sprite with 3-4 frames.

    Or if you have an alternative idea, please tell me.

    How would you do this?

  • I can't find a solution for my project.

    I created a special effect for my game.

    It works like this: There are many different enemies (spaceship, UFO, asteroid, space monster etc...)

    every time one of these objects is destroyed, functions start.

    Download and try the file and you will understand what I want to achieve.

    The event creates clippings of the image (using and dynamically creating a drawing canvas object and a "mask" with the blend mode destination out) to make it appear as if the ship falls apart when destroyed and the pieces fly away.

    But I can't get them to rotate correctly.

    Could you give me an idea? Perhaps you know another way to accomplish this.

    https://drive.google.com/file/d/1kofEUV0WKOJGAd7bVgYUY2cZBBtMjOBA/view

  • I want my character to move through the path. But what I want to achieve is different from the examples in the "pathfinding" behaviors guide.

    In the image there are many dots and lines, if I click on a dot the program finds the quickest path and the character begins to move to the closest dot until reaching the selected one.

    In the examples of the guide there are solid objects that prevent passage and force you to find the path. In my case it's the opposite: the character must move within the dashes.

    I had written a complicated algorithm and it worked, but now I want to update it and I don't understand it anymore. maybe with the "pathfinding" behavior I can get the same result or better and faster.

    but is it possible?

  • Hi everyone.

    I've been working on a video game for a while now

    I posted on the play store, I don't know if I should post a link because I did it as a paid app, maybe I shouldn't spam.

    But here's my question:

    My game is space shooter style (that's the name of the game). With some differences, for example there are images of approximately x100/200 px which I then resize (I will try to reduce the dimensions to a minimum but they are artistic images so I cannot reduce them to 10x10.

    But I created all the levels by inserting spaceships, asteroids, etc... in each layout measuring 50000 x 480 (the maximum).

    however I inserted objects up to a maximum of 20000 px.

    The viewport continuously moves to the right showing incoming enemies, up to the level width entered in a dictionary object.

    Here's the question:

    The fact of already having all the objects created in the layout (there can be 50-60 plus the small star images of 20x20 px created randomly at the beginning of the layout which can even be more than 100!)

    Does it greatly affect the performance of the game?

    Would it make sense to record all the objects with their properties in a dictionary, change the layout size to 854 x 480 px and create the objects at 1000px and make everything move to the left?

    That is, creating a dictionary with example:

    time 1sec. --> asteroid(height 200, size, variables, etc...) time 3 sec --> enemy (height etc...)

    And make a function that creates enemies like that?

    it's a job that takes some time because I want to recover all my levels as they are.

    Does it make sense to do it?

    Because I see my game lagging on my smartphone, and it will lag even more in the future.

    What is best to do?

    Tagged:

  • How to make visible an object that is outside the view port and that is on screen.

    for example some buttons on the pad

    I can't understand, if an object is completely out of the viewport it cannot be considered "on screen" condition.

    what do you mean exactly, explain better.

    would you like the buttons/objects to move completely into the viewport on their own? Or that the viewing screen moves?

    In that case you can do scrollx/

    scrolly+-.

    This is another good solution to bring the object onto the screen.

  • I'm trying to create json files with all the information of my layouts and create others automatically.

    I have to acquire all the data regarding the variables of all the sprites, now I have this problem:

    If I do: console.log(Sprite.InstVars) I get an output (like in the screenshots).

    But I can't get the variables any other way.

    if I do:

    Sprite.LocalVars.variablename

    I get that variable, but I want to use .localvars because I need to get all

    and how many there are.

  • could you also tell me how to insert the variables into JSON format?

    How can I do the same thing with the JSON plugin?

    JSON --> set value --> Set "."&loopindex&".height" to int(FamilyALL.height) what is written above in my screenshot, how can I do it with the script?

    I should get in the console:

    "Level_1": {

    "Sprite": [ { "posx": 20291, "posy": 223, "size": 50609, [{ ---> ObjVar1: 999, <--- ---> ObjVar2: zzz, <--- ],}

    }

    ],

    I'm also fine with doing everything with the script, but for each of my objects in the layout I need to have all the information regarding it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I tried to use your code but it gives me an error on key<> and I don't understand why.

    Sorry, I don't use JS often, it should be != instead of <>

    I assumed you know Javascript since you asked for a script solution?

    Here is a demo.

    https://www.dropbox.com/scl/fi/iw8pscxnqot8t6dnx0965/JS_InstVars.c3p?rlkey=nrdw9bcn9s4yn0k61jc6ra03d&dl=0

    Yes I'm studying javascript step by step. but I'm still at the beginning.

    Thank you so much!

    I also inserted a new sprite and got the variables of all using getFirstPickedInstance:

  • > I didn't understand how to use the first one.

    It's easy. Save Sprite.AsJSON to a text variable. Later, when you need to restore, create a new Sprite instance and use "Sprite Set From JSON" action - it will restore its position, instance variables and all other properties from the saved JSON.

    > I would like the console.log to also write the object variables not related to the family.

    You know which variables are related to the family - simply exclude/ignore them when running the "for (var key in o.instVars)" loop.

    > for (var key in o.instVars) {
    
    if (key<>"FamVar1" && key<>"FamVar2") {
    console.log(key + ": " + o.instVars[key]);
    }
    }
    
    

    Sorry, I can't understand, could you give me a practical example?

    I tried to use your code but it gives me an error on key<> and I don't understand why.

    Could you make a sample project and post screenshots?

    Thank you.

  • to show the range to the player you can create a "circle" object and increase its size for towers with longer range.

    To define when the towers can start shooting you can use distance.

  • I was looking for a solution and discovered this thread.

    I have the same problem and I can't go and add the layer to those 500 layouts every time.

    Has a feature been added for this issue?

    construct.net/en/forum/construct-3/how-do-i-8/replicate-new-global-layer-149322

  • If you need this to save/restore sprites on the layout, you can use Family.AsJSON expression. It will save all object properties, including the values of all instance variables. However, there will be unique codes instead of variable names.

    Or you can retrieve all instance variables with this script:

    > const o = runtime.objects.Family.getFirstInstance();
    
    for (var key in o.instVars) {
    console.log(key + ": " + o.instVars[key]);
    }
    
    

    I tried the second method (the script), because I didn't understand how to use the first one.

    That's not what I meant anyway.

    I would like the console.log to also write the object variables not related to the family.

    I put up some screenshots.

    I also modified some variables in the layout view of the objects (related to the family) but in the console the 4 variables are always 0 and "" and false. (probably because it's not correct how I made the events and how I included your script. I don't know how to do.)

    Sorry for the strange names, but I'm Italian and I program half Italian and half English.

brendanpoke's avatar

brendanpoke

Member since 7 Aug, 2019

Twitter
brendanpoke has 1 followers

Trophy Case

  • 5-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

8/44
How to earn trophies