R0J0hound's Recent Forum Activity

  • Well first of all, have a look at the "pick closest" condition. It does exactly what your loop does. So you could do your above code with three conditions.

    Objectfinder: ischeckingfortarget is true

    System: For each objectfinder

    ObjectA: pick closest to (objectfinder.x, objectfinder.y)

    So now let's talk about what you want to do. So roughly this:

    Start

    Each finder pick closest obj and save it as finder.target

    Move finder to their target

    If the distance to the target is less than some distance

    Then go back to start and pick another close object but not the old target.

    What I'm not clear on is when the finder gets close to it's target and it picks a new one, do you want it to ignore just the last target or do you want to ignore all previous targets? Or do you want to do something else?

    I just re-read what you wrote, so I guess you want a target, once reached to be ignored until the finder gets X distance away.

    I guess you could filter away all the objects that are close to the target before finding the closest.

    I'd give your finder object a variable called target with a default value of -1. Then Your events could look like this:

    Finder: target = -1

    For each finder

    System: pick Sprite by comparison distance(Sprite.x,sprite.y,finder.x,finder.y) > 100

    Sprite: pick closest to (finder.x, finder.y)

    --- finder: set target to Sprite.uid

    For each finder

    Sprite: pick by uid finder.target

    --- finder: set angle to (Sprite.x, Sprite.y)

    --- finder: move forward 100*dt pixels

    For each finder

    Sprite: pick by uid finder.target

    System: compare distance(Sprite.x,Sprite.y,finder.x,finder.y) <100

    --- finder: set target to -1

    Edit: ninja'd

  • newt

    Not really. I mean you can think of it as a combination of sprites and tiled backgrounds when it's drawn, so as far as draw calls, maybe. In reality it's probably less, but that's not what's happening here IMO.

  • I'll have to look at your capx later when I'm home but here's a few thoughts:

    If webgl is enabled I'd still recommend using the paster object because the canvas has to be copied to a webgl texture every tick that it changes. And actually the text object does the same thing so maybe you could use Spritefonts instead.

    Actually if that is the bottleneck you can quickly check by setting webgl to off in the project settings. If the performance increases and the cpu usage goes down then I'd just leave webgl off, as it eliminates the need to copy the texture of the canvas and text instances.

    Another thought is unless you're clicking or constantly checking what the mouse is over shouldn't the collision checks per second be 0? I guess I'll see when I open the capx.

  • Pick by uid is the exception. It can pick any new object at any time. You can find some more details about top level events by searching for top level in posts I've made.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have a look at the SpriteFont.TextHeight expression. If it's less than SpriteFont.Height then all the text fits in the box.

    To set the scale to fit all the text you could do an iterative approach with a loop. Basically it tries a scale of 1.0, sees if the text fits and if it does stop the loop. If it doesn't

    repeat 100 times

    ---> spritefont: set scale to (100-loopindex)/100

    --- spritefont: height > spritefont.textheight

    ------> stop loop

    Here's an example:

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

  • 1) the bullet behavior would work fine.

    2) just set the bullet's speed angle of motion and gravity, but you could do whatever.

  • It should be everything, at least for the system and official plugins. If anything doesn't then that would be a good reason for a bug report.

    For third party plugins it depends if the author implemented that part or not. I know for example most of my plugins don't impliment saving and loading, but I guess that's on me.

  • Maybe something like this to save if you just want to save positions.

    Set array size to (Sprite.count, 2, 1)

    For each Sprite

    --- set array at (loopindex, 0) to Sprite.x

    --- set array at (loopindex, 1) to Sprite.y

    Then maybe this to load:

    Array: for each X

    --- create Sprite at array.at(array.curx,0), array.at(array.curx,1) )

  • Just use multiple layouts. No need to deal with xml or databases.

  • You could use a global variable I suppose. I don't know when you make it jump, so for example every second you could do this.

    Global number move=0

    Every 1.0 seconds

    --- simulate jump

    --- set move to 1

    --- wait 0.5 seconds

    --- set move to 0

    Move = 1

    --- set velocityX to 100

  • I can't open your capx atm, but the every tick event is where you set the starting X,y, and velocities. In what I typed about it uses a object called cannon's position and angle.

  • The idea there is we need to keep the object's y position below the starting y. If the object goes above the sqrt in the equation will make the speed NaN because you can't get the square root of a negative number.