R0J0hound's Forum Posts

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

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

  • My guess is "every dt seconds" will in practice will have the possibility of running less than a "every tick" event.

    As I understand it the "every dt seconds" event could be done like this:

    global endTime=0
    
    endtime >= time
    --- Set endtime to time+dt
    --- do stuff
    [/code:1u5sb0c0]
    So if it ran on a slow frame it could not run on the next frame if it was a fast frame.  Although it could still be acceptable, unless absolute precision is needed.
  • The effect would be checking for an overlap in a certain rectangle area. You can do this with one collision check by first changing the size and position of the object to cover the area, checking for overlap and then restoring the object size and position to what it was before.

    What's your use case?

  • Did a quick test and yes, sprite sheets are made for all plugins using pf_animations. On a side note it appears that only non-square power of two images are sprite sheeted. I first tried three 32x32 frames but on export they each stayed on their own image, also the sprite object did the same. I then resized them to 16x32 and the export did pack the images into sprite sheets.

  • The only thought that comes to mind is to try using pf_animations in a plugin and export to see if a spritesheet is generated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is no NULL in C2. Where would you want to test for NULL?

    The only example I can think of is when using the find() expression. It will return -1 if the text can't be found.

  • Here's a link one what that method is called:

    http://www.saltgames.com/2010/a-bitwise ... -tilemaps/

    Here is one way to do it with sprites:

    viewtopic.php?f=147&t=72925&p=611090&hilit=bitwise#p611090

    And here is an example using the tilemap object

    span-class-posthilit-tilemap-span-auto-tile-help_p721581?#p721581