R0J0hound's Forum Posts

  • The box2d one is per object, whereas the chipmunk one applies to everything. You can replicate per object with a force proportionate to the object's speed and in the opposite direction.

  • Add a sprite to use as a line, and make it's origin centered on the left. Also make it's height 4 or something, that will be the line thickness. Name the sprite "line".

    Then you can use the qarp() expression to do the curve and you could do this:

    global number px=0

    global number py=0

    every tick

    --- line: destroy

    --- set px to start.x

    --- set py to start.y

    repeat 100 times

    --- create line at (qarp(start.x, (start.x+end.x)/2, end.x, (loopindex+1)/100), qarp(start.y, (start.y+end.y)/2+200, end.y, (loopindex+1)/100)

    --- line: set angle toward (px,py)

    --- line: set width to distance(self.x,self.y,px,py)

    --- set px to line.x

    --- set py to line.y

  • I'm on my cell so I can't write a whole lot but:

    1.

    All the old lines are destroyed, and new ones are created every tick.

    2.

    It's done every tick Regaudless.

    Another thought, the variable I had "px" is short for previousX instead of playerX. It better represents what they do. Also the every tick event relates more with event 6 so I had it right above it as I recall.

    In events 4 and 5 the corner that is being added or removed aren't the ones being compared with the distance.

    In event 6 it's looping from the corner that was last added to the one that was first added. I went that way so I could set px before the loop started. So the lines would be created between the locations player,corner,corner...

    I can maybe make up a picture to explain all of it better.

    Edit:

    The motion bit would be best done manually I think. The physics or any of the behaviors aren't really suited for it.

  • Guess I'll cross post this:

    If you have a list of tiles that you don't want to be solid, you can copy the tilemap and remove those tiles when the game runs.

  • Ok, here's an example. Just set toErase to a list of tiles that are decoration.

    The tile numbers are numbered like this:

     0  1  2
     3  4  5
     6  7  8
     9 10 11[/code:rdxv0r8t]
    
    [url=https://dl.dropboxusercontent.com/u/5426011/examples31/partial_solid_tilemap.capx]https://dl.dropboxusercontent.com/u/542 ... lemap.capx[/url]
  • Yeah, that's not an error. Hmm, It's puzzling why the window doesn't show.

  • Here's a capx of the idea:

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

    The movement still needs improving.

  • My reasons for writing a plugin/behavior are these:

    1. Adding a feature that events can't do.

    My paster/canvas plugins are an example of that. They add the ability to draw to a texture which isn't possible otherwise. I think another one was a spritesheet plugin.

    2. Interfacing with some existing JavaScript library or code.

    This kind of blends with one sometimes. Examples include the chipmunk behavior and the peerjs plugin.

    3. Speed improvements.

    The only example I had for this is my isometric behavior. I had it working with just events, but since it had multiple nested loops it wasn't very fast. Actually I think the sorting algorithm was O(n^3) worst case. There is some overhead with the event system so converting to js allowed me to sort 3x as many objects and still not affect the framerate.

    Other than that I'd avoid doing it for something specific to one project. Others do it, but for me it's more tedious.

    I'd recommend playing around with the sdk yourself though, it's fairly easy. I'm not sure it would be simpler to make your idea with a plugin than events though.

  • You could try finding the remainder of every number from 2 to one less than the number with a loop. If the remainder is ever 0 then it's a composite.

    Global number num=8175

    Global number isComposite=0

    Repeat num-3 times

    Compare num%(loopindex+2) =0

    --- stop loop

    --- set isComposite to 1

  • I think gumball's idea should work. It's just using a sprite to make a line, but that part can be dealt with later.

    The first task would be to get the motion working in tight spaces like that, and not get snagged at intersections. I think a pacman tutorial would probably help with this, since the motion is similar. Aka. Motion in tight corridors.

    To keep the object from crossing it's own path is the next problem. Basically you could have a square at each intersection and make them solid as needed.

    To do this you can use an array as a list of corners. The list starts with just the starting corner in it.

    When the distance between the player and the last corner in the list gets big enough, then the last corner the player overlapped is added to the list. The idea here is if the distance is bigger than the distance between corners then the player passed a corner.

    To do the backtracking, the distance between the player and the 2nd from last corner of the list is compared, and if it's less than a edge length, remove the last corner from the list.

    So now that gives you a list of corners. If you keep all of them but the last one solid, then you can keep the player from crossing it's path.

    Finally you can take that list and make lines between them all and from the last to the player. You could either use gumball's idea or the canvas plugin I suppose.

    Anyways that's the idea at least, I was going to try to type out events but it seemed more understandable describing it. I haven't tested the idea yet but it should at least be a start.

  • Are the tiles you want to be solid and the ones you don't want to be solid always the same? Like certain tiles no matter where they are placed should not be solid but decoration.

    If that's the case you could copy the tilemap when the game runs and erase all the decoration tiles and leave the solid ones. Then make the duplicate invisible and make it solid. Basically you'd use two for loops and erase certain tile values.

    It would save you time if you wanted to make drastic changes to the map. Of course it wouldn't work if you wanted hidden walls I suppose, but even then you could mark those in another way.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try looking through the list of addons:

    As I recall there was one that lets you display a webpage inside the game area. Think it was something like "frame"?

  • I had a test, and when you do for example this:

    Start of layout
    --- python: System.Create("Sprite", 1, 100,100)
    
    always
    --- Sprite: rotate 100*timedelta degrees clockwise[/code:36t5neww]
    
    Only the new sprite will rotate.
    
    But if you add a "for each" everything can be picked again.
    [code:36t5neww]Start of layout
    --- python: System.Create("Sprite", 1, 100,100)
    
    for each sprite
    ---
    
    always
    --- Sprite: rotate 100*timedelta degrees clockwise[/code:36t5neww]
    
    It only needs to be done after creating an object from python and even then it only needs to be done once. Also the object used can be anything.
  • A path through paths is going to require some kind of math.

    That spline path behavior and that example you mentioned both satisfy your second requirement to spend the same time between any two points.

    To control the shape in between the points you could use a different spline such as bezier. You can use the qarp() or cubic() expressions to hide most of the math, although you'll still need some math to keep the paths continuous form one pair of points to another.

    dropbox.com/s/k67oxzz6jqt114g/cubic_path.capx

  • If you look in the function object section of the manual you can call a function in the event sheet from javascript. You could then mute it there in the event sheet.