R0J0hound's Forum Posts

  • 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

  • Try Construct 3

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

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

  • The expressions

    Sprite.bboxLeft

    Sprite.bboxRight

    Sprite.bboxtop

    Sprite.bboxbottom

  • Guess it would be tricky converting everything over. Usually I just round as a last step and keep the unrounded variable and apply all changes to that.

    Anyways, here’s another idea to convert it. I’m assuming on your machine it runs at 60fps, so if you put all your events as sub-events to this it may work. It just only runs when the time passed is a 1/60th of a second. Just an idea at least. Triggers and new object picking may throw it off.

    Variable prevtime=0

    Compare: prevtime+1/60 <= time

    — add 1/60 to prevtime

    — put all events here

  • Well it should be as simple as:

    Every tick

    — sprite: rotate 100*dt degrees towards (320,240)

    Where 100*dt means 100 degrees per second.

  • Just replace the random() stuff to whatever you like. Random can be defined as random(min, max) of that helps. All a box is a low and high value vertically and horizontally.

  • You do not have permission to view this post

  • There’s a “rotate toward position” action that lets you smoothly rotate to face a location.