mekonbekon's Recent Forum Activity

  • kncuser

    I literally ran into this issue myself just now - turns out I'd been doing all my z-tweening on objects at the centre of the screen, which works fine. I then tried it on an off-centre object and was stumped as to why it was tweening weird. I figured it out and came to post here, but you'd beaten me too it! :-)

    I'm guessing you could simultaneously tween the x,y back to the initial position? I'll give it a go and report back.

  • nicely done! that works very well - I haven't done much with Z-elevation.

    Cheers :-) I've only recently started exploring it myself, lots of potential when combined with the new pin features.

  • Tweening the z-elevation works well for scaling text and spritefont:

    dropbox.com/scl/fi/6miu96xx6e1yb5ihyi7rl/scalingWithZ.c3p

  • You can wrap the offset without having to use additional conditions by using the modulo (%) expression in the action:

    -> TiledBackground: Set image X offset to ((Self.ImageWidth+Self.ImageOffsetX+backgroundSpeed*dt)%Self.ImageWidth

    This will automatically reposition the offset once it exceeds the image width.

    It's worth using a variable for the background speed rather than a fixed variable as it allows you to easily manipulate the background movement during play.

    A negative backgroundSpeed value will reverse the direction of movement.

    Switch width to height and X to Y for vertical movement.

  • The issue is that all three events will trigger on the mouse click in sequence because each event is setting the conditions for the next one; event 2 sets the frame to 1 so event 3 is true, and so on.

    Here's one way to deal with this:

    On left button clicked on sprite: Set animation frame to min(self.animationFrame+1, self.animationFrameCount-1)

    This will step up the frame number each time you click up to the maximum frame number (animationFrameCount-1).

    Here's another:

    On left button clicked on sprite:

    =>Sprite animation frame = 0: set animation frame to 1

    =>Else Sprite animation frame = 1: set animation frame to 2

    =>Else: set animation frame to 3

    In this example you use a sequence of "Else" sub-events to allow you to step the frame number.

  • Both spritefont and text objects scale fine using z-tweening:

    dropbox.com/scl/fi/6miu96xx6e1yb5ihyi7rl/scalingWithZ.c3p

  • It's hard to say what's happening without seeing your event sheet or debug output - are you using two separate array objects, one for each array file?

    In C3 you can load multiple arrays from files in sequence as follows:

    On start (or function, or whatever):

    AJAX: Request array1.json tag "array1"

    System: Wait for previous actions to complete

    Array1: Load from JSON string AJAX.LastData

    AJAX: Request array2.json tag "array2"

    System: Wait for previous actions to complete

    Array2: Load from JSON string AJAX.LastData

  • I also had this issue with 9-patch the other day. The problem with scaling a 9-patch by changing the height and width is that the corners & edges will keep to the preset margin values. Instead I dealt with it this way:

    1. Pin the image to the 9-patch

    2. Set the image pin behaviour to include pin Z-elevation

    3. Add the tween behaviour to the 9-patch

    4. On touch/release tween the z-elevation value of the 9-patch

    The additional benefit of using this method is that you can use the tween ease settings to easily create some nice scaling effects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In event 1 the choose expressions for the sound and tag won't necessarily pick the same name.

    Instead, set a global or local variable e.g.:

    On start:

    set pick to choose("eraser","pencil","ruler","scissors")

    Play pick (tag pick)

    This will ensure your sound and tag match.

  • A. The default animation frame speed is set to 5. Can we change that to 0? Or at least get a setting in preferences?

    Yes please! This has bugged me for ages - I find it very rare to require a speed of five and about half the time I need it at 0.

  • Note, that this code can create 2 or 3 instances of the same sprite. If you need to create 3 different sprites, it's a bit more difficult.

    This is made a lot easier with the Advanced Random plugin, which allows you to create permutation tables.

    I've included three ways of doing it in this demo:

    dropbox.com/scl/fi/si6o4fynjq422lj9s7xv2/pickNrandomObj.c3p

    1) Spawn a random family member - this has the benefit that you can use non-numbered sprite names, but can result in repeats.

    2) Use a permutation table to pick a numbered sprite - no repeats.

    3) Use a permutation table and an array loaded with the family member names to pick a non-numbered sprite - no repeats.

  • Here's a simpler function map example that hopefully is a stepping stone to the official example:

    dropbox.com/scl/fi/eb4ygsmpqtvot3etxw62v/functionMap.c3p

    In the official version they add in two other steps:

    A parent function ("CallColor") that allows you to pass parameters to the function map.

    A "Default" function in the function map that will catch any calls that don't match with any functions in the map.

mekonbekon's avatar

mekonbekon

Early Adopter

Member since 9 May, 2014

Twitter
mekonbekon has 13 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

19/44
How to earn trophies