R0J0hound's Recent Forum Activity

  • 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

  • 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

  • Try Construct 3

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

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