R0J0hound's Recent Forum Activity

  • From the system expressions manual page.

    https://www.scirra.com/manual/126/system-expressions

    [quote:2mxahcdl]right(text, count)

    Return the last count characters of text.

    Use that with a system compare condition with right(EditBox.Text, 1) = " "

  • Without more info about the sub-events I'd say no. If the sub-event has conditions that pick boxmutant objects then comparing the object count is redundant since if there are no instances then it automatically won't run.

    Basically for optimizing you should only optimise slow areas and somehow check performance before and after to see if things were improved. Me personally, I try to keep events simple and readable. The profiler can be useful to check what percentage of the country's each event group is using, and help identify what areas need More attention.

  • Every tick set sprite size to (50*OriginalWindowWidth/WindowWidth, 50*OriginalWindowHeight/WindowHeight)

  • As you wrote it in your first post:

    enemy compare var

    enemy is overlapping enemy

    enemy is overlapping laser

    And your last post:

    enemy is overlapping laser

    enemy is overlapping enemy

  • Ok, I had a go with the math bit. First here's the capx

    https://dl.dropboxusercontent.com/u/542 ... rsect.capx

    Basically it's projecting 3d points to the screen. The first 8 points are just to visualize the room so I could get the background to match. The rest of the points are found from the intersections of rays from the light source to the walls. The ugliest part was the rotation math to get the spotlight to change direction.

    The spotlight can then be drawn as a polygon with the point locations using the canvas plugin.

    https://dl.dropboxusercontent.com/u/542 ... light.capx

    It's not perfect at the edges of the walls. To fix that additional points would need to be calculated for where the lines intersect from the view of the light, as best I can tell.

  • One way that comes to mind is you could calculate the distances between each point on the first stroke with the line segments of the second. Add the shortest distance for each point to a sum.

    Here's an algo to find the distances:

    http://stackoverflow.com/questions/8492 ... ne-segment

    You probably would need to the reverse as well for the best accuracy.

    In the end the lower the sum the more alike the strokes are. 0 would be perfect,

  • valdarko

    It only works with it if webgl if off, since it internally uses the non webgl draw functions of objects. With webgl on the tilemap object doesn't need to set up it's non webgl images so when the canvas tries to use them it can't because they aren't there.

  • Katala's way would be the most accurate, but the math could get a bit hairy looking to calculate the control points.

    You can do skewing with my Paster plugin. Which works with webgl on or off so there's no real reason why skewing can't be supported directly in C2.

    Anyway you can get an approximate look by pasting the spotlight onto pasters around the edges of the back wall and taking that and stretching it on a quad that covers the wall.

    https://dl.dropboxusercontent.com/u/542 ... light.capx

    It's not done but it gets the idea down with the left wall and half the bottom one working. Note this isn't a perspective transforms so I split the pasters in half to get it to look better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The issue is when the pin behavior is run. The basic loop is:

    pre tick behaviors -> events -> post tick behaviors -> draw -> repeat

    "drag n drop" is "pre tick" and "pin" is "post tick" so the pinned object's positions won't be updated from the dragging object until after the event sheet.

    One solution is to keep track of the change of position of the dragging object and adding that to the position when you wrap.

    https://dl.dropboxusercontent.com/u/542 ... g_pin.capx

    Another is to not use the pin behavior and do it in events. If anything it gives more control.

    https://dl.dropboxusercontent.com/u/542 ... _drag.capx

    Edit:

    The for eaches and events 4,5,7 & 8 are for the visual wrapping of tiles.

  • How are you doing the wrapping?

    Edit:

    I'm guessing you may be doing something like this for the wrapping:

    Sprite x > 640
    --- Sprite: set x to 0 [/code:2rkaazyg]
    So if moving slow sprite.x will be just past 640, but if fast then sprite.x may be way over 640.  The point is anything over 640 is discarded.
    
    So to keep the extra don't set x to 0, rather subtract 640 from it.
    [code:2rkaazyg]Sprite x > 640
    --- Sprite: set x to self.x-640 [/code:2rkaazyg]
  • You could do this to do something exactly 10 times per second.

    global elapsed_time=0
    
    every tick
    --- add dt to elapsed_time
    
    repeat int(elapsed_time*10)
    --- subtract 1/10 from elapsed_time
    --- do something[/code:2niyz02n]
    
    You can extend than to take into account time.  So for instance you can have a constant stream of evenly spaced bullets at say 10 per second.
     [url=https://dl.dropboxusercontent.com/u/5426011/examples25/bullet_exact_interval.capx]https://dl.dropboxusercontent.com/u/542 ... erval.capx[/url]
    
    Edit:
    This could have a downward spiral effect if the framerate takes a bad it because this will make it worse.
  • Isn't using event sheets programming? The "how do I..." portion of the website is a perfect place for implementing algorithms or functions from traditional programming into Event sheets. However if you mean programming in ->insert other language here<- then yeah, that's better suited for other forums.