keepee's Forum Posts

  • shameful bump and edited post to be shorter.

    whoops i just checked out

    http://www.box2d.org/manual.html#_Toc258082972

    and so it seems this is a box2d thing.. still seems weird though

  • did you make sure the Offset vars are global/static?

    if not, they will be returning to their initial value (probably 0) every tick

  • ah I see, i misunderstood what you were after.

    to solve the first problem would have just been a case of using 'scroll'

    set TargetX to scrollx + (Gamepad.Axis(0,2)*width*0.5)

    but that's not really relevant now I understand what you want..

    if you create some extra vars you can try this:

    add Gamepad.Axis(0,2)*sensitivity to OffsetX

    add Gamepad.Axis(0,3)*sensitivity to OffsetY

    set TargetX to OffsetX + ScrollX

    set TargetY to OffsetY + ScrollY

    you can use clamp() to limit the Offset inbetween the view edges using the ViewportLeft/Right/Top/Bottom expressions.

    if you wish to implement layout scaling or layout rotation to your game, you should create a UI layer with that does not scroll, scale or rotate, then there's no need to add on the ScrollX or ScrollY.

    If you do that though, you then need to determine what the TargetX is on the actual gameplay layer, so you may need to use the CanvasToLayer() expression

  • so are you asking to be able to change the res output of the video card.. like with non-browser games?

  • Irbis zenox98

    protip: x key

  • terence

    my bad, i just checked the manual and find that gamepad.axis() returns a value between -100 and 100, not -1 and 1 like I assumed.. so of course you just need to divide it

  • the force at which two phys objects rebound is based on simply which of the two elasticity number is highest

    This seems odd, as colliding two balls with elasticity's of 1 and 1 gives the same result as colliding elasticity's of 1 and 0.1

    I think they should be multiplied together.. the advantage of this is that you can create an object with an elasticity of 0 that doesn't rebound no matter what collision.

    This would be really useful to me and anyone else who has attempted to make a decent physics platformer. Currently the only way to stop the player bouncing off the ground/objects when landing atop, is to set absolutely everything it may collide with's elasticity to zero.

    This change will require physics behaviour users to tweak their elast values, but I believe it makes more sense for it to work this way

    I'm not sure if this is even a C2 or a Box2D thing, but I figured I'd post anyway just in case.

  • So I need a way of mapping the gamepad axis to an X,Y position for the cursor.

    I'm not sure why you'd want this instead of the traditional twinstick style..

    but anyway, I dont have a gamepad to test this with, but to my knowledge gamepad.axis() returns a value inbetween -1 and 1

    so if you can correctly retrieve the width and height of the screen you can try this:

    set TargetX to (Width*0.5) + (Gamepad.Axis(0,2)*width*0.5)

    set TargetY to (Height*0.5) + (Gamepad.Axis(0,3)*height*0.5)

    In place of Width/Height You could try using WindowWidth and WindowHeight, but to my experience they can get a little messed up depending on other settings. I work around it by just creating global variables called BaseWidth and BaseHeight, I set them to the same setting as what I have for 'window size' in the project properties.

  • You can create a Boolean instance variable on your sprite, and then use the 'toggle boolean' action

    On touched sprite: Toggle Sprite.Selected

    is Sprite Selected: spin!

  • I did a basic gravity simulator a while ago but lost the .cap file

    i remember the equation though

    multiply the two masses, and then divide by the distance between the two.

    you can then multiply that whole thing by a constant to fine tune how strong you want it.

    i was using physics so it was

    ((body.physics.mass*body2.physics.mass)/distance(body.x,body.y,body2.x,body2.y))*constant

    apply that force to both the body's towards each other. It worked perfectly

    edit: i forgot, the distance between the bodies was squared

    http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation

  • Link to .capx file (required!):

    https://dl.dropboxusercontent.com/u/53374990/Forum/bugs/r154AsymetricalCollisionMasks.capx

    Steps to reproduce:

    1. preview .capx

    2. press space to toggle physics off and on

    Observed result:

    If a physics object has an asymmetrical collision polygon, and an offset origin point, the collision polygon gets screwed up.

    this is new to r154 & was not present in previous versions, including 153 when asm was inserted.

    it happens regardless of using box2d web or ASM

    Expected result:

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: untested

    Operating system & service pack:

    win7

    Construct 2 version:

        154 only

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think what you read was referring to is the 'is overlapping' condition, which isn't a trigger, you can place it below other conditions.

    but for the 'on collision' trigger, you can work around the way it forces itself to the top by just making it a sub event to a blank event.. i've done it a few times and i've not noticed any bugs.

  • have you tried using the 'is clockwise from' condition?

    you can invert it for anti-clockwise

    using the angle related stuff in c2 should work regardless of whether the angle is negative or above 360 or whatever.

  • do you mean how to make an object snap to grid?

    if so you can do:

    set object x to round(object.x/8)*8

    and replace 8 with whatever gridsize you want, or a variable

    do the same for Y

    if your hotspot is in the top left corner, use int() instead of round()

  • ALLMarkMade

    Do you mean local vars or private vars?

    local variables are created the same way global variables are. If you drag a variable to be subevent, it becomes a local variable... and vice versa.

    The only difference is that Global variables are always Static, but you can make local vars static too. Static means it remembers what the value of the variable is after each tick.

    And then private variables are ones which are held by an object or a family.. so they are not created on the event sheet.

    The manual will explain these things better than me though.. so it's better to read about them there. Is there anything in particular about the .capx that you don't understand?

    emoaeden

    So do you want a particle effect to be created and destroyed for each fan when toggled active? Because you can do the exact same as what i've done for the 'fanarea' object. If you replace every occurence of 'fanarea' with the particles equivalent, it'll probably help you understand the .capx better. And then you can modify it to have both the fanarea and the particles together.

    Other people may choose to do this in other ways though, for example you could have the particles and fanarea both in a container for the fan.. that means they will always exist in the game, not be created and destroyed unless the fan is. In this case you have to some more toggles -set the particles active/inactive, and only apply the force when the fan is active also.