GauVeldt's Forum Posts

  • If not save and load at least you might implement HashTableObject=JSON.parse(inputStringOfHashTable); and outputString=JSON.stringify(HashTableObject); on your JS object (I suspect you would be using a JS object type for the hashtable) for the corresponding deserialize and serialize operations which is 90% of the work to save and load.

  • How about just doing a naive delimited-list search returning the index of the first element matched? Being able to search the list imho is kind of important and would be better than using find(sep&list&sep,needle) as a kludge which doesn't yield a proper index.

  • The existing system expression tokenAt(list,index,delimiter) will yield which token is at the specified index.

    tokenIndexOf would do the opposite, that is, tokenIndexOf(list,query,delimiter) will yield the index of the specified query token or -1 if it is not in the list.

  • I've encoutnered that:

    tokenCount("",",") = tokenCount("foo",",")= 1

    Is this really correct result for this expression?

    I would think an empty string should have 0 tokens.

  • Maybe add an expression to yield the current CD as fraction from 0 to 1 (0 meaning CD just activated, 1.0 meaning ready). The value may be used to lerp things like sprite frames to show the cooldown state (possibly the "clock" effect to show the action's cooldown timer like you see in C&C, Diablo, WoW, etc).

  • Doesn't JS have some JSONify operations you could use for the save/load part?

  • I think the devs overlooked this one when they added the tokenXXX expressions...

    How about adding this oversighted findToken expression for finding which position a token is at if it is in the list. 0 is a valid position doing things the C2 way so -1 may need to be used as the "not found" result.

    eg 1: findToken("catacombs,cat,catastrophic,triplicate","cat",",") should yield 1

    eg 1: findToken("catacombs,cat,catastrophic,triplicate","ata",",") should yield -1

  • Re: touchmouse plugin

    Enabling "Use mouse input" property on Touch object might be used for similar purpose for those wanting similar functionality in the Arcade (which prohibits, among several things, 3rd party extensions).

  • Doesn't this restriction make the arcade less-than-useful for all but the simplest of games (since not even storage is supported)?

  • Can you provide a example capx? I cannot figure out how to use this.. I set a destination x and origin x but no movement :(

    http://dl.dropbox.com/u/55284551/testEase.capx

    Edit 2012.01.01 15:25

    - cleaned up the capx slightly

  • Can you provide a example capx? I cannot figure out how to use this.. I set a destination x and origin x but no movement :(

    Unlike bullet the movement is not automatic. It is meant to be initiated by calling one of the EaseIn, EaseOut or EaseInOut actions on the behavior.

    Adding a System->Do Every X seconds event is one way to trigger the action

    Edit:

    I'll make a capx to show that now...

  • TODO: Add a Do-Not-Reposition boolean property to allow stacking the behavior for multiple effects with different durations. Think like Sonic where he spins up, flies across the layout map then slows down. The spin up/down can then be one behavior and the movement another but it won't work right if each Ease behavior tries to set position they'll fight with one another as each changes the object's X and Y. With this boolean any non movement Eases may be stacked with another behavior that does (eg: bullet or another ease with the Do-Not-Reposition property set False). One would be able to make swirling bullets (bullet behavior + ease that changes angle only) or blinking objects (ease that changes only translucency) with this property available.

    Edit 2012.02.03:

    TODO: Make transition properties (eg: originX, originY, destinationX, destinationY) accessible at run time either via properties (if plugins can do this) or set/get methods. Can any of the plugin veterans give me any advice on going about this?

    • Suggested by TL22
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Simple but subtly powerful behavior for doing eased interpolation between two points. Easing means the transition is smooth when close to the endpoints. This functionality is similar to the sine behavior but additional properties, expressions and actions make it more powerful.

    Get the plugin here (ZIP)

    The naive use of the behavior is to make an object "ping-pong" between two points.

    Origin X,Origin Y

    • the "ping" point

    Destination X,Desitnation Y

    • the "pong" point

    Transition Period

    • time taken to complete the transition

    Actions:

    - Move easing into (EaseIn)

        end of transition is smoothed

    - Move easing away (EaseOut)

        beginning of transition is smoothed

    - Move easing both (EaseInOut)

        both beginning and end of transition are smoothed

    All three actions work in ping-pong fashion alternately

    from call to call (first action called will go origin-to-dest, second destination-to-origin, third origin-to-destination, and so forth).

    Call the action will no-op if a movement is already in place. The time lerp is independant of the position so changing the position should not lead to any sort of runaway object (non halting movement). The time lerp will clamp if out of bounds to the property setting if you mess with the transition period mid-movement. Do not set the transition period to exactly zero as it is sure to stop your game due to divide-by-zero (time fraction is calculated as current_elapsed/transition_period). Maybe there is a way to have the transition_period property reject any change that sets it exactly zero? I'm not quite sure how to go about it.

    Additional Actions:

    - Change origin endpoint

        Allows changing the origin endpoint at any time,

        even mid-transition.

    - Change destination endpoint

        Allows changing the destination endpoint at any time,

        even mid-transition.

    - Change transition period

        Allows changing the transition period to any nonzero value.

        Changing mid transition may cause clamping and snaps to return

        the values to the new range but it should not crash the game.

    The endpoint actions can be used to do waypoint type movements or any sort of complicated pattern of bumps, shakes, etc. of an object.

    Three conditions may be used for event to know the state of the transition:

    • Is at destination

       object is at "ping"

    • Is at origin

       object is at "pong"

    • Is in transition (invertible to mean "Is stationary")

       object is moving (or inverted: not moving)

    Expression for events:

    - IsEasing

        1 if object is moving otherwise 0

        (expression form of Is in transition)

    - GetTransition

        Returns the status of transition

        result is a float in range 0 to 1 inclusive

        0 matches IsAtOrigin condition

        1 matches IsAtDestination

        A more powerful feature is to use this expression

        to apply something other than movement to the object

        (eg: Set angle to -180*myObject.GauVeldt_Ease.GetTransition)

    Triggers:

    - On Endpoint Reached

        fires when object completes movement cycle

        Condition IsAtDestination/IsAtOrigin may be used in

        subevent or GetTransition may be used to know which

        endpoint the object is at

    - On Update Tick

        this one is subtly very powerful as it provides the ideal

        trigger upon which to add actions using GetTransition to set

        other object properties (eg: visible, angle, etc). Sure

        you could do it in System:OnEveryTick but I think this is

        cleaner in practice (a system event would need a whole bunch

        of sub events to test the location, movement status, etc)

    I think that's everything. One final possible improvement is to allow customization of the transition functions (there are three) EaseIn for the start of a transition, EaseOut for the end of a transition and EaseInOut for both. Right now the transition functions are internal but it could perhaps be modified to accept JS expressions in string properties using eval to compile to functions. That's for future consideration.

    Edit:

    PS: To do eased rotations or fades, etc., with no movement just set the origin and destination to the same point as its layout position. A TODO item is to add a movement-ignore flag for just these kinds of non-movement transitions.

    Edit 2012.02.10:

    Added Set Origin, Set Destination, and Set Period actions for changing the movement location via event sheet actions.

  • I want to throw this out for discussion.

    Edit: Tiled might be a good editor (I dunno, haven't used it) but tailoring C2 features towards it specifically would be a really bad move. What if Tiled stops being worked on?

    Allowing C2 to read XML files and generate terrain based on that would suffice, no need for specific Tiled features I'd say.

    Tiled is an open source GPL project meaning that if the current developers ever retired and maintenance became necessary (on tiled as used for Construct2) then Scirra could make upstream changes to tiled in the case tiled became the de-facto editor in practice for tiled maps in Construct2. This is not a new arrangement. Disney (and partnership with Carnegie-Mellon University) maintains the open-source Panda3D engine where it is being used as the de-facto engine for projects including their Pirates of the Caribbean and ToonTown MMO's.

  • You could do it with a bunch of events (one for each key you want to record) to append each keypress to an offscreen text object.