R0J0hound's Forum Posts

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's one for the physics behavior:

    But you can do it without with simply:

    global number gravity=1000

    global number speed=200

    global number step=0.1

    global number vx=0

    global number vy=0

    global number x=0

    global number y=0

    every tick

    --- dot: destroy

    --- set x to cannon.x

    --- set y to cannon.y

    --- set vx to speed*cos(cannon.angle)

    --- set vy to speed*sin(cannon.angle)

    repeat 100 times

    --- add gravity*step to vy

    --- add vx*step to x

    --- add vy*step to y

    --- create dot at (x,y)

  • It looks like it stops working, or at least jumps, when it goes to just one touch. Maybe setting the oldtouch value when a touch is released would alleviate that. I think I addressed that in my original capx, but I haven't looked.

  • If you're not checking for performance with the sprite then disabling the collisions won't matter.

    Yeah, only the image size affects the amount of vram used. The size of the sprite doesn't matter. Also, there is no performance difference.

  • I wasn't aware there was a way to disable collisions. An "on collision" is basically a "is overlapping" with a trigger once. Collisions are only detected with a object if it either has the solid behavior or you use one of those events.

    The image size doesn't affect the performance. It just reduces the amount of vram used which can be important for mobile devices.

  • In 1 and 4 "this" is the current instance.

    In 2 "this" in the onCreate function is the current instance. It's set to a global variable so the instance can be referenced in that widow callback.

    In 3 self is used so the callback "errorFunc" can access the instance. Otherwise I think this would be the global window object.

    The following link probably is better help:

    http://javascriptissexy.com/understand- ... master-it/