R0J0hound's Forum Posts

  • Here is a basic way to do it:

    Every Tick:

    + Sprite: set X to: Sprite.X + 1

    Sprite: is overlapping Wall:

    + Sprite: set X to: Sprite.X - 1

    If the motion is more complex another way to do it would be to save the sprite's x,y position in variables before moving the sprite. Then if it collides with a wall you can undo the motion by setting the sprite's position to the values in the variables.

  • I haven't opened your capx but here's an idea to do the sliding of the tiles.

    1. When you start dragging store the start position, and the x,y distances to the empty space.

    For example if the tiles are spaced every 100 pixels:

    empty above: x,y distances= 0, -100

    empty below: x,y distances= 0, 100

    empty left: x,y distances= -100, 0

    empty right: x,y distances= 100, 0

    2. Then while dragging contain the tile's position from the start position to the x,y distances.

    ex for x:

    start_x + clamp( Mouse.X - start_x, min(0, x_distance), max(0,x_distance))

    3. On the end of the drag just snap the tile to the grid.

    Example capx:

    http://dl.dropbox.com/u/5426011/examples%208/9tile.capx

  • Doesn't the "rgbaAt" expression do the trick?

    There are other implementations of flood fill that don't use recursion:

    http://en.wikipedia.org/wiki/Flood_fill

    Here I used the array object to implement a queue to keep track of what points to fill next.

    https://www.dropbox.com/s/3qryv0kech869 ... .capx?dl=1

    /examples%208/floodfill.capx

  • Try this:

    + Sprite2: is on ground

    -> Sprite2: Set 'canUseJetpack' to 0

    + Sprite2: Pick by Sprite2[Platform].VectorY Greater than 500

    + Sprite2: is falling

    -> Sprite2: Set 'canUseJetpack' to 1

    + Sprite2: Value 'canUseJetpack' Equal to 1

    + MouseKeyboard: Key Z is down

    -> Sprite2: Set vertical speed to Sprite2[Platform].VectorY-6000*timedelta

  • An erase action is not possible, globalCompositeOperation is set by the object being pasted. To do an erase effect, you would have to set the effect of the object you're pasting.

    Sprite: set effect to "destination out"

    Canvas: Paste "Sprite"

    Sprite: set effect to "none"

  • This works using python to access the winapi:

    http://dl.dropbox.com/u/5426011/examples%208/getIco.zip

    Note: The transparency of the icon is not preserved with this method.

  • It looks like you used "Copy collision mask to each frame". It is currently broken and causes the collision mask of every frame to be empty.

    An oft used solution is to have a separate sprite for the collisions. Any behaviors are applied to the hitbox sprite, and player sprite's position, direction and animations are set with events.

    The events will look like this:

    + System: Always (every tick)

    -> Sprite: Set angle to hitbox.Angle

    -> Sprite: Set position to object hitbox (image point 0)

    + hitbox: [negated] is moving

    -> Sprite: Set animation to "idle"

    + hitbox: is walking

    -> Sprite: Set animation to "running"

    + hitbox: is falling

    -> Sprite: Set animation to "falling"

    + hitbox: is jumping

    -> Sprite: Set animation to "jumping"

  • You need to manually move the platform so the player can be moved with the same amount as the platform.

    Here's one way to do it using a dummy sprite. The motion is applied to the dummy sprite, then if the player is overlapping the platform move the player with the change of the dummy's position and then move the platform to the dummy's position.

    http://dl.dropbox.com/u/5426011/examples7/vertical_platform.capx

  • Try this for setting text to a number to two decimal places:

    int(num) & "." & int(num*100)%100

  • New version R3.

    newt

    I just noticed that alpha values have to be in the range 0 to 1. I fixed the descriptions and rgbaAt to reflect that.

    It will actually accept any CSS color value.

    http://www.w3schools.com/cssref/css_colors_legal.asp

    So you can use hsl or hsla also.

    Animmaniac

    Added a line width parameter to the "draw line" action.

    Also added a "draw circle" action. It only draws an outline, but if you want it filled use a "Fill path" action directly after.

  • New version released. Re-download from first post.

    newt

    You can draw with paths now.

    https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes

    capx:http://dl.dropbox.com/u/5426011/plugins/pathDraw.capx

    rexrainbow

    Added fill canvas with gradient. It has horizontal,vertical,diagonal and radial.

    Pode

    It will refresh automatically now.

  • Drawing is relative to the canvas, so if the canvas has it's hotspot at the top left corner you would use:

    Draw point (Mouse.X-Canvas.X, Mouse.Y-Canvas.Y)

    newt

    That should be doable, I'll work on adding that.

  • Canvas Plugin updated 2/9/2014

    Download:

    https://app.box.com/s/vj4l7k8upl5ywoch9zf1qg0nt3064mnt

    Actions:

    Paste Object

    Resize canvas

    Draw point

    Draw line

    Draw box

    Fill color

    Clear canvas

    New R2:

    [Fix] Canvas will now automatically redraw.

    Actions:

    + Fill canvas with gradient

    Path drawing actions:

    + Begin Path

    + Move to

    + Line to

    + Quadratic to

    + Bezier to

    + arc

    + Rectangle path

    + Set line Settings

    + Fill path

    + Draw path

    Expressions:

    + rgbaAt

    + getImageUrl

    New R3:

    [Fix] pasting objects on scaled canvas'.

    + The draw line action now has a line width parameter [warning: may cause capx made with previous version not to open. + Draw circle action. [Fix] When choosing colors the alpha value is in the range of 0 to 1, rgbaAt now returns a usable value.

    New R4:

    [Fix] Now works with WebGL. (thanks to Yann)

    [Add] Additional hotspot locations top-right,top, etc...(thanks to Yann)

    [Add] Paste Layer action(thanks to Yann)

    [Change] Paste object/layer action now only paste visible objects.

    New R5:

    [Add] FloodFill. (Thanks to Pode)

    One of the interesting features this has is the way colors are chosen.

    You can use any of the following:

    "black", "blue", "orange", "gold", etc...

    "#00FF00"

    "rgb(100, 10, 1)"

    "rgba(20, 30, 40, 0.5)"

    "hsl(120, 50%, 50%)"

    "hsla(120, 50%, 50%, 0.5)"

    Note: alpha values are from 0 to 1.

    Another nice side effect of this plugin is you can now use all the effects that html5 has to offer.

    http://dl.dropbox.com/u/5426011/plugins ... index.html

    capx:

    http://dl.dropbox.com/u/5426011/plugins/effectTest.capx

    If anyone encounters any bugs or has a feature request for this let me know.

    -cheersR0J0hound2014-02-09 23:17:12

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On xp the canvas is not currently hardware accelerated. It's only accelerated on windows systems with direct2d such as vista and 7.

    This probably will not always be the case as Mozilla's eventual plan is to use opengl to do the acceleration on systems without direct2d.

    Here's an overview of Firefox's rendering engine Azure:

    http://blog.mozilla.com/joe/2011/04/26/introducing-the-azure-project/

    And here's a forum with Azure's current progress:

    http://forums.mozillazine.org/viewtopic.php?f=23&t=2233499

  • I don't understand the question. You can set the acceleration with an action. What doesn't work? Or what happened and what did you want to happen?

    You can limit the max speed with clamp like this:

    + Always

    -> Sprite: Set Path Speed to clamp(Sprite[PathMovement].GetSpeed, 0, 'maxSpeed').

    Also keep in mind that acceleration is directional. Positive acceleration accelerates toward the end of the path, and negative toward the beginning.