Ruskul's Recent Forum Activity

  • Hey everyone,

    Has anyone heard of physics freezing objects position update if friction coefficients are changed more than once per frame for that object ?

    Example:

    set friction to someobject.defualtFriction

    some condition is met -> set friction to something else on that object

    I have an easy workaround (I just have an instance variable that is changed and then friction is updated once at the end of the event sheet - but I think that should be done internally.

  • Colludium - from what I think I know, those bugs may not be fixable in asm.js - Which ones are you referring to? Disabling collisions is the only one I can think of right now - Which would be nice to be sure.

    As for Aphrodite's question, I hope so too

  • Ah I might try that.

    The method I've been using is to create unseen objects every tick and then stop spawning them once the FPS drops to the desired amount.

    Thats what I used to do as well. It gets the job done though in a rather roundabout manner.

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

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

  • Try Construct 3

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

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

Ruskul's avatar

Ruskul

Member since 23 Nov, 2013

Twitter
Ruskul has 2 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies