R0J0hound's Forum Posts

  • newt

    It just calculates all the distances and picks the closest.

  • I made up an example for that paper since it looked cool growing from one location:

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

    That said it is not simpler than the first example. Which tries 200 times per frame to find a good spot. Also it can be made to stop if enough dots are made.

  • It's following what the code you posted does.

    aka take a number of random points and find their distance to a closest other point. Finally just keep the closest of them all.

    In the capx it just creates a bunch of sprites, and destroys all but one.

  • Call events what you will, but they are the way to code the logic in C2. Regardless you can still use a c2 project as a reference to create the same thing in another tool.

  • You can use any program/coding language as a reference for anything else. It'll never be one to one because of syntax differences but the logic/algorithm is the same.

  • SamRock

    You just need to loop over all the isometric objects a find the x and y extreme positions. The scroll clamping assumes the iso objects cover more than the screen, so it uses half the screen size (320,240 in this case) to make scrolling stop at the edge.

    global number boundleft= 99999

    global number boundright= -99999

    global number boundtop= 99999

    global number boundbottom= -99999

    start of layout

    for each sprite

    --- set boundleft to min(boundleft , sprite.bboxleft)

    --- set boundright to max(boundright , sprite.bboxright)

    --- set boundtop to min(boundtop , sprite.bboxtop)

    --- set boundbottom to max(boundbottom , sprite.bboxbottom)

    every tick

    --- scroll to (clamp(scrollx, boundleft+320, boundright-320), clamp(scrolly, boundtop+240, boundbottom-240))

  • You can reverse the damping with

    max(1000-distanceHereToThere, 0)

    Basically any distance above 1000 won't be damped, and any within 1000 will.

    With the above the damping increases linearly, but you can square it to make it increase in a more drastic way.

    max(1000-distanceHereToThere, 0)^2

    • Post link icon

    Oh, it changes when you save your project. The op sounded like it happened when using the save action in events when the game is running.

    I've never encountered this, but I think it would be useful to report as a bug even without a capx.

    • Post link icon

    You're saying the save action sometimes changes the value of a global variable? The thing is logically that's not possible since the save action shouldn't modify anything, and if it did it should be reliably happening. But that's just based on my experience.

    Let's take a step back though. The two possibilities is the issue is either with C2 or with your events.

    You can absolutely check if C2 is to blame by setting some text with that variable right after like this:

    set text to globalvar

    save

    set text to self.text&" "&globalvar

    If the two values ever differ then C2 is to blame and I'd hope a bug report could be made so Scirra could fix it.

    If they're always the same then the issue is elsewhere in your logic. This would be a case where it would be nice if the debugger let you step through events more. Regardless you can also do text debugging like above, the browser log action is also useful instead of just text objects. Basically find all the places that set that variable in the event sheet and log it. Then when you run your game and you see the variable change you can pause and look in the log. You can even save the event number in the log text like so to know what event is changing it.

    browser log "event 10: set global to "&globalvar

    Anyways that's just some ideas into hunting down the cause.

  • You have it outlined right there. Use an "on click" event and compare the animation frame. Also the "else" condition can be used for the other frames.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It actually looks like the path the 8-direction behavior gives you. The soft max speed could be achieved by maybe setting the max speed higher and let it drop down with:

    max_speed = max(current_speed, normal_max_speed)

  • stachir

    It may still be a bug with vsync and the browser on your device. Maybe something along the lines of this bug:

    https://bugs.chromium.org/p/chromium/is ... ?id=422000

    It references this site to test the vsync of your browser. If frames are never dropped the word "vsync" should look grey, otherwise it will flicker.

    http://www.vsynctester.com/

  • It's a 2d game so it should be possible, even with vanilla C2 (no third party plugins). Basically there's two parts to it: visual and logic.

    For visual you can use sprites or tiledbg for the lines and for the filled in areas you can just break it up into multiple rectangles.

    The logic could be done by keeping track of the edge polygon of the level and dividing it and seeing if a the enemy locations are inside them.

    There was a topic about qix, but I forget if a completed example was made. There's a similar game called quolox or something where an example was made which could be useful.

  • Hmm... I'd have to think about it more. Instead of the gradual angle change what is the desired result?

    Yeah to add vectors together you need them in X y components.