R0J0hound's Forum Posts

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

  • Try Construct 3

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

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

  • That may be due to "double buffering", at least it sounds like it. Basically everything is drawn off screen first, then flipped to the screen. The result is a one frame delay behind mouse or touch input. It's less visible at higher framerates, since the distances between frames is less.

    Now as far as I know C2 has no control over this, the browsers internally handle this detail. It's the same with android export I imagine but there might be a setting. I've never used mobile export so I don't know.

  • keepee

    Thanks for the capx. Fixed now. Re-download in first post.

  • The 8direction behavior only sets the angle when moving. What you want to do is set the angle based on what arrows are pressed.

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

  • keepee

    Ok, I see what the issue was. Re-download on first post. The other object will never be the same object now.

    In your example if two balls are stacked only one will get an opacity of 50, so you need an action to set the ball's opacity as well.