R0J0hound's Forum Posts

  • Which example? I've probably made too many. Depending on the example it's possible to make functions that take more than one parameter. Do you have a full list of features you want it to have? I'm guessing you want all the expressions that construct expressions have?

    numbers: 22, 33, 1.66

    binary operators: +-*/^

    unary operators: -

    parenthesis: ()

    functions: sqrt(x), min(x,y), max(x,y), sin(x),...etc.

    Can even make it have the the conditional operator (?:), but that can be a bit trickier.

    Even though I use old functions it shouldn't be confusing. I tend to follow the pattern of making local variables which i immediately set from function.param(n), which works the same as function parameters. At any rate i tend to not use c3 if i can.

  • You can also write a parser that does it. Basically it pulls out the numbers and operators from the string and solve it.

    This can be preferred over just running it as JavaScript for a few reasons.

    1. If the string is something the player writes they could take advantage and run arbitrary code.

    2. You have more control over how the text is parsed and the error messages if there is a typo.

    Anyways here are a list of various examples of the parsing way of doing it.

    construct.net/en/forum/construct-2/how-do-i-18/possible-convert-string-154631

  • Beveling the corners of the objects or merging together objects in a row would help fix it.

    It seems to be a general issue with physics engines.

  • The Wikipedia articles on them have pseudo code on how they are done. In construct I’d say utilize the json plugin to manage the data structures needed, although they probably could be done with arrays albeit with some tedium.

    There are simpler structures like a uniform grid with a list of the objects in them, as well as binary space partitions that may work well too.

    If your levels has stuff mostly on a grid I’ve had great speed boosts from using and array to store if a grid location has an object or not.

    Guess the gist of all of them is adding/removing objects from the structure, and getting a list of objects overlapping an aabb.

    Event loops and picking kind of slow things down so for the greatest benefit I’d recommend utilizing JavaScript to do it if you can.

    So I’d say best, as in fastest, would be going with JavaScript.

    If utilizing just events, use json.

    But those are just general ideas.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just checked and the link isn’t dead.

  • You could also do it with a local variable, but it’ll still be two events.

    Local number any=0
    Sprite: x=33
    —— set any to 1
    Any=0
    ——do something

    The else one isn’t bad. It lines up pretty good with the logic of picking.

    The main rough spot with the picking system is the top level event picking of newly created objects.

  • It varies. Events are an interpreted language that’s run with JavaScript. There is some overhead, but it’s mostly just chunks of JavaScript.

    You won’t notice the performance difference unless you’re doing some taxing algorithm. And even then it may be something else that’s causing the slowdown.

    Still I once implemented an isometric sorting algorithm in just events. It was cpu bound. Unsatisfied with how many objects it could handle before slowing down I made a plugin that implemented the same algorithm and got it to handle ten times as many.

    But like was said it probably was just some different values used in ghost shooter. That example isn’t cpu bound.

  • Looks doable. Visually it’s just sprites with some zsorting.

    Motion wise I’d go with doing it from a top view and just updating the isometric view from that. The most novel part being the variable height terrain. You may be able to use existing motion behaviors but I’d go with doing it in events to give more control.

    I expect a lot of it was actually pretty simple, and instead was just clever use of animations.

  • The custom movement behavior's collision response has always been bugged like that in my experience. aka it tends to a certain direction.

    I have a few ideas how you can do what you want.

    One I tried was to keep using the 8 direction behavior and put the player on a different layer that isn't rotated. but the motion was still oriented to the layout. Setting the parallax to 0 for the layer that the player was on just did some wonkiness.

    A second idea could be to do the motion with events and just use the 8dir behavior for collision response. Here's some events that replicate the 8 direction motion but lets it be in relation to the object's angle. This was an older example and i didn't make a complete test for your setup.

    dropbox.com/s/4penvg8h3u85iiy/events_8dir.capx

    Another idea, that i ended up testing, was to just use 8 direction and rotate all the other objects around the player. It seems to work well and is fairly simple. Just have to duplicate some actions for each object type you want to rotate.

    dropbox.com/s/0d95vfncalh7i7k/rotateAroundPlayer.capx

    On a side note it's possible to cut out the 8direction behavior completely to get stuff like wall sliding. But that's not exactly related to your post.

    construct.net/en/forum/construct-2/how-do-i-18/8-direction-behavior-slide-95148

  • You can just do it with the keyboard object.

    global text key=""
    
    on any key pressed
    -- set key to Keyboard.StringFromKeyCode(Keyboard.LastKeyCode)
    -- compare: key = "backspace"
    -- -- text: set text to left(text.text, len(text.text)-1)
    -- compare: len(key) == 1
    -- -- text: set text to text.text & key
  • Here's what your events could look like to have basic functionality. You click buttons to setup the list of commands and clicking run will make the cat move.

    global number running=0
    global number step=0
    global text cmdList = ""
    global text cmd = ""
    
    clicked on LeftButton
    ---- add "left," to cmdList
    
    clicked on RightButton
    ---- add "right," to cmdList
    
    clicked on forwardButton
    ---- add "forward," to cmdList
    
    clicked on clearButton
    ---- set cmdList to ""
    
    clicked on runButton
    ---- set running to 1
    ---- set step to 0
    
    compare: running = 1
    every 0.5 second
    ---- set cmd to tokenat(cmdList, step, ",")
    ---- add 1 to step
    ---- compare: cmd = "forward"
    ---- ---- cat: move forward 32 pixels
    ---- compare: cmd = "left"
    ---- ---- cat: rotate 90 degrees clockwise
    ---- compare: cmd = "right"
    ---- ---- cat: rotate 90 degrees counter-clockwise
    ---- compare: cmd = ""
    ---- ---- set running to 0

    From there the rest is just visual stuff.

  • You can also take it a bit further and make the groups in the layout editor itself.

    dropbox.com/s/3xzkx3og9ay7gz7/objectGroupTemplates.capx

    You can extend it beyond just positions by just storing more in the arrays.

  • Decibels are actually on a logarithmic scale, so it would be:

    decibels = 20*log10(percent/100)

    0% -> -infinity db

    50% -> -6.02 db

    100% -> 0 db

  • Here's some examples:

    c2:

    dropbox.com/s/rpi4nzhd763b4l6/pointInPoly.capx

    dropbox.com/s/65neg3btcb6mdzr/pointInPoly2.capx

    c3:

    dropbox.com/s/ga41909z93g71nq/pointInPoly2.c3p

    I ended up converting the text point list to an array, but otherwise the math is the same.

  • For the math method you can do it by looking at a line from the point going down. If it crosses an odd amount of lines it’s inside the polygon, otherwise it’s inside.

    Here is what the events would look like if you just had sprites making up the points. You could use an array or text list but I’ll leave that as something that would need to be adapted.

    Global number x=100

    Global number y=100

    Global number inside=0

    Global number i=0

    Global number j=0

    Repeat p.count times

    — set i to loopindex

    — set j to (i+1)%p.count

    — value (x-p(i).x)/(p(j).x-p(i).x) is between 0 and 1

    — y > (p(j).y-p(i).y)/(p(j).x-p(i).x)*(x-p(i).x)+p(i).y

    — — set inside to 1-inside