Ruskul's Forum Posts

  • From the manual a common expression is .asjson and there is also the common action "set from json".

    I haven't used it myself yet but I believe it can be used to clone object state.

    I'll check that out - If not, I didn't consider 3rd party plugins, but I'll check out the gthub example.

    Its a bit weird, but I have shyed away from working with custom plugins and behaviors (I don't even write them myself) - part of this is because If I am going to code I bust out unity, which I find more user friendly in that aspect. Perhaps I have not given construct 2 enough time. But Given there is very little documentation on writing plugins and or behaviors... idk.

  • I don't normally bump...

    but seriously - nobody has ever wanted a copy of an object instance during runtime... Nobody has wanted to copy behavior settings at runtime?

    If you have 30 variables on an object and you want a new instance to be the same you have to:

    1. create the new object, and store its uid

    2. store the UID of the object you want to copy

    then...

    then ignoring the mess of trying to pick the same object type and setting the correct one to the other correct one...

    Self.variable_A = Object.Variable_A

    Self.variable_B = Object.Variable_B

    Self.variable_C = Object.Variable_C

    Self.variable_D = Object.Variable_D

    Self.variable_E = Object.Variable_E

    Self.variable_F = Object.Variable_F

    Self.variable_G = Object.Variable_G

    Self.variable_H = Object.Variable_H

    ... and so one.... if you have complex objects, or compound objects, get ready to have a nightmare and no way around it...

  • TwinTails - My method is pretty much the same as using global constants - I just put them in an object because I NEVER use global variables; mostly because you can't sub group globals while you can use objects to sub group variable names... without subgrouping variables I can end up with hundreds of globals... and their names have to be stupid long to keep them organized (i.e... Character_FinalBoss_AtackStrength_01) this in turn makes some of the events harder to read...

    In the end I create an object PlayerFunctions or BossFunctions... I then tend to name all variables according to certain conventions that allow me to keep them organized yet still easily accessible in that huge drop down list* ... and since I can sub group objects, finding what I want quickly becomes easier.

    player_fm.caculateAtackVector (m = shortcut for math, f shortcut for function)

    then that variable would be set to something like: "Player_Functions_Math_CalculateAtackVector" ... A real pain to spell out every time you want to call it... The beauty of it is that you never even need initialize any of these data storage objects as you normally just need their variables as constants.

    While I am thinking about that dropdown list.... I think it is stupid*. It works when you have like 4 variables but not when you have dozens, if not hundreds... You can't even type in the name of the variable... you have to select from the list... but in other cases you can actually type it in. For example:

    If I set a variable to some value, I have to select the variable from a giant drop down list. Only the first keystroke works to find it, but as I use v_before most variables this does me no good.

    The reason I use v_before most variables is because If I do the following:

    Player.physics.velocityX = V_somevariable .... and I haven't organized my variables its hard to find the variable in a list of all the sprites expressions and so on... Again, the default conventions are nice, but not in large projects. The bigger the project the more tedious some things become.

    I would love a data object that simply stores variables, instead of having to use a sprite...

  • Functions needs to actually store and "know" the current list of function.

    A current workaround is to create an object that stores function names in text instance variables. When you want to call a function you enter that object.shortcut name for function. I was thinking, why not allow the function to store and know the names of its own functions.

  • Hey,

    Have you ever wanted to be able to manually set max framerate for testing purposes. To my knowledge, there is no way to do this in construct 2, However, I have a hack that works quite well.

    Go to your graphics properties (it may be in the system tray, or you may have to access it in the control panel)

    Change the refresh rate of your monitor (ex 40hz or 60 hz).

    Construct 2 fps will not exceed the refresh rate of the monitor. Note that not all monitors are equal and some will look awful with particular refresh rates. Also, you may not have the option, but if you need a way to test multiple frame rates this method is nice!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fimbul Aphrodite - Yes, that is indeed true. You have to reference objects that don't necessarily exist. And I don't think that changing default values at runtime would be wise... but I was original only thinking of changing global states (such as physics or pltformer gravity direction; something you really don't need an object to do, but do.

    Aphrodite - On create is a lovely event trigger, but there are some problems with it that I can't get around. For example: I can't send on create any parameters so I don't know what object spawned the object if I am dealing with compound objects. Thus, if I just run on create logic, I lose the the ability to have the creator in my list of objects.

    I am not saying it should be different, I 'm just giving a shout out to help others not make the mistake I did. I literally had a problem for several months, and instead of realizing I made a call in the wrong place, I spent hours trying to figure out why physics wasn't working as expected. I found problems that weren't the problem and changed things that didn't need changed.

    Ashley - Thanks, that makes sense. High five for all your hard work. Construct 2 is the bomb.

  • Aphrodite - but that's just it - you can reference a non existing item in construct. You shouldn't, but you can... and construct 2 doesn't tell you when you do... I nice log file in debug mode might be nice... Like "Hey, I called this function, but it doesn't exist, just so you know".

    rho - that's it in a nut shell.

  • You should create a family - then add all the tiles that can be placed in that family, that way way you can just program the family to do what you want and not have to repeat the events for each tile... Though I think you do have to create an individual sprite for every color you want...

  • Hello,

    I am just getting into writing shaders and I really can't seem to figure out why this doesn't work... (I'm sure some of you may notice it is a modification of setcolor fx bundled with construct 2)

    All I want to do is invert the alpha without messing with anything else, but that's not what happens. It works fine on one object but when you layer the objects or have different colored backgrounds it stops working:

    /////////////////////////////////////////////////////////

    // Flip Alpha effect

    varying mediump vec2 vTex;

    uniform lowp sampler2D samplerFront;

    uniform lowp float red;

    uniform lowp float green;

    uniform lowp float blue;

    void main(void)

    {

    lowp float a = texture2D(samplerFront, vTex).a;

    lowp float r = texture2D(samplerFront, vTex).r;

    lowp float g = texture2D(samplerFront, vTex).g;

    lowp float b = texture2D(samplerFront, vTex).b;

    gl_FragColor = vec4(r,g,b,1.0-a);

    }

    <?xml version="1.0" encoding="UTF-8" ?>

    <c2effect>

    <!-- About -->

    <id>flipalpha</id> <!-- Never change the ID. Change the name instead -->

    <name>Flip Alpha</name>

    <category>Alpha</category>

    <description>Invert Alpha Channel</description>

    <author>Ruskul</author>

    <!-- Settings -->

    <!-- Extend the bounding box for effect processing by a number of pixels to show the edges

    of effects which go beyond the object edges, e.g. blur and warp. -->

    <extend-box-horizontal>0</extend-box-horizontal>

    <extend-box-vertical>0</extend-box-vertical>

    <!-- Set to true if the background is sampled (samplerBack is referenced at all in the shader) -->

    <blends-background>false</blends-background>

    <!-- Set to true if the background is not sampled at 1:1 with the foreground (e.g. the

    background texture co-ordinates are modified in some way by the shader, as done

    by Glass and Lens) -->

    <cross-sampling>false</cross-sampling>

    <!-- Set to true if the effect changes over time, e.g. Noise or Warp effects. -->

    <animated>false</animated>

    <!-- Parameters -->

    <parameters>

    <param>

    <name>Red</name>

    <description>Red level to set, from 0 to 100.</description>

    <type>percent</type>

    <initial>1</initial>

    <uniform>red</uniform>

    </param>

    <param>

    <name>Green</name>

    <description>Green level to set, from 0 to 100.</description>

    <type>percent</type>

    <initial>0</initial>

    <uniform>green</uniform>

    </param>

    <param>

    <name>Blue</name>

    <description>Blue level to set, from 0 to 100.</description>

    <type>percent</type>

    <initial>0</initial>

    <uniform>blue</uniform>

    </param>

    </parameters>

    </c2effect>

  • Hey everyone,

    I have a story and something you should avoid.

    When writing events in construct, you can refer to an object that has no instances. This is fine if you want to read some default instance variable or behavior value off it - such as max speed or gravity power. But what you can't do is change something that doesn't exist. For example:

    On start of layout -> set playerObject physics stepping mode to framerate independent...

    more events, more events, more events... blah blah blah...

    Create playerObject at playerSpawnpoint.

    The result of this is that you do not have framerate independent physics because you couldn't change the physics behavior from an object that doesn't exist. In a large project with thousands of events, errors such as these can be easy to create, nearly impossible to find and worse may remain hidden for weeks.

    Don't spend hours of debug time trying to figure out why something doesn't work only to find a mistake like this. The worst part is construct is happy to go along with bad events like this... same thing for calling functions that don't exist. Its like if you told an employee to bring the client in the waiting room some coffee. The employee goes to the coffee room and finds no coffee. Instead of telling you, he just abandons all other subsequent instructions and asks for the next set of directives... Well, he thinks to himself, you are the boss and you must know there is no coffee. What a bizarre instruction. Oh well, best to carry on.

  • zenox98 - thats what I was looking for.... I looked around for that but couldn't find it >.< (I have owned construct 2 for a year now and never new the preference button existed >.>

    Thanks.

  • RESOLVED

    Problem Description

    I recently used a second monitor while working with construct. In order to transcribe an objects instance variables into another language/engine I opened the instance variable dialog and placed it on the other monitor. I now no longer have access to a second monitor but construct remembers the position of the instance variable dialog window as being on the other screen. I can't edit them now!

    I have disabled the second monitor in properties and control panel and as far as the computer goes, there is no second monitor but construct 2 keeps opening dialogues off screen if that was the last place they were!

    Construct 2 has no "set windows and dialogues to default positions" option (which many programs, such as photoshop, have in order to fix this issue) Is there a way around this? If not I would say construct 2 needs a way to move dialogue windows back on screen! I can't work on my project right now.

    ------------------------

    edit

    It is possible via windows shortcuts to select the dialogue window and move it on screen.

    Alt+space -> m -> hit an arrow key -> move the mouse around till you can see it.

    Attach a Capx

    n/a

    Description of Capx

    n/a

    Steps to Reproduce Bug

    • Step 1 - Plug in a second monitor and move a dialouge to the second screen space. Save project and close.
    • Step 2 - unplug and disable the second monitor. Re open construct 2.
    • Step 3 - Open up previously used dialogue windows (such as instance variables) that had been moved to second monitor... (they open off screen and can't be touched/edited)

    Operating System and Service Pack

    Windows 7, latest service pack

    Construct 2 Version ID

    Release 173 (64 bit)

  • Howdy,

    I have plenty of solutions laying around as there are many but my favorite way is the following:

    Terminology:

    ObjectCollider = the object that collides with solids and is the object that is moved around

    ObjectState = The object that determines what direction collisions are occurring from. The size of the sprite should be one pixel greater on all sides as the objectCollider, with the same origin as well. The collision polygon should then be adjusted so that it is only on the right of the Sprite. Depending on the scenario, you will need to adjust the relative sizes of the boxes based on your needs. Also, the Object state needs the following instance variables: Up, Down, Left, and Right (they are booleans). This way will work if the object is square or round. (if other then see note below)

    Whenever you create an ObjectCollider it creates an Object State (you can put these in containers so it happens automatically, but if you need them in families it gets a little more difficult as you would need to track UIDs and use parents)

    Every Frame, ObjectState needs to be updated in the following ways:

    1. Set its position to the parent ObjectCollider

    2. If it is overlapping an object that is Solid set "Right" to true, else set it to false.

    3. rotate ObjectState 90 degrees (now it is facing down) and test for overlapping solids...

    4... I think you can figure out the rest...

    If you are not using a round or square object, then you will need to create an ObjectStateUp, ObjectStateDown, and so on and attach them to respective image points on the ObjectCollider.

    Any Questions? Overall, this is a pretty basic need in games and I am supprised their has not been made a behavior to get that data. I need this in every game I make so I created a blank project that uses families and does it all automatically when I create an object and put it in family SpriteColliders.

  • Hey everyone!

    I think the title says it all... Construct2 needs to be able to copy objects. Further It should also be able to copy shared instance variable through families. For ex:

    Bat (of family FlyingAnimals) = Eagle (of the same family)

    Behavior copying should aslo be allowed... ie:

    SomeObject.physics settings = someObject.physics settings.

    Construct 2 also needs to be able to pick any object and then test its type. With only 1 family (and since families are abstract you always need to refer to objects) things get difficult with complex objects.

    anyway...

  • Hey Everyone!

    I think construct 2 needs to allow one to be able to group instance variables.

    For example

    Group Constants could contain acceleration, deceleration, jump power. You would access these in the event sheets by... SomeObject.Constants.acceleration.

    This isn't needed for small scale projects but as soon as you need more complex behaviors you need tons and tons of instance variables. I used to just make multiple objects to store different info (like playerState and playerMath) - but given constructs limitations in polymorphism you can't simply scale a project built like that...

    anyway... it would help with organization. My hunch is that those of you who disagree either haven't attempted anything grand in scale or found a better way to organize data in construct 2 (in which case I am all ears!)

    Thanks!