Dalal's Recent Forum Activity

  • My game targets the standard 16:9 aspect ratio, and the window size is set at 1080x1920 (it's portrait).

    Because it's 1080p, it looks super crisp. However, I want to see if I can give it a performance boost by reducing the resolution down to 720p, or 720x1280. It'll look slightly 'softer' on high-res devices, but nothing too horrible.

    The problem is that the game is a bit complex, and going through and adjusting every object and event to work with the new resolution will be arduous and prone to error. Is there an easy way to scale the whole game down in a way that reduces the amount of pixels the GPU needs to render?

    A dynamic approach is preferable, but any ideas you guys have, no matter how good/bad, will be much appreciated! Thanks.

  • You might consider moving the balls yourself, either with a CustomMovement behavior, or just by giving the balls XSpeed and YSpeed variables and Every Tick setting Ball.X to Ball.X + Ball.XSpeed*dt and Ball.Y to Ball.Y + Ball.YSpeed*dt.

    This way you'll have control over each axis separately (I don't know if the behavior you are using already allows that). You want the YSpeed to always be the same no matter what kind of hit. For angled hits, add a little speed to the XSpeed to bounce it off to the side. The effect this will have is that angled hits will move quicker through the air (since their overall speed will be higher), but their YSpeed will be the same, causing them to come back down at the same time.

    Now, this method might serve you for short play times, but due to the various inaccuracies that occur due to the ball hitting the player at different offsets (sometimes at lower Y coordinates, sometimes at higher Y coordinates, and at slightly different times, with a fluctuating frame rate), over long plays you might find that it becomes unfair again, even though the initial offsets were correct. For this reason, I would suggest re-enforcing the offset right after a player hits it. You might try saving the time offset in the ball, and then when you hit a ball, use Ball.Offset and the current time to determine when to release the ball upwards so that it falls back into its correct pattern.

  • I think Event 3 needs one more condition. "Is Not Crouch Attacking".

    It was freezing because Event 3 would set its animation to Idle first, and after that you'd change it back to CrouchingAttack. Since this would happen every tick, it would never get the chance to go to the next animation frame.

    These events are prone to such errors though. I would suggest trying to use more sub-events and Else conditions for neater logic. For example:

    On N Pressed
         Player Is Standing
            Do standing attack animation
         Player Is Crouching
            Do crouching attack animation
        etc.
    [/code:2vxkp847]
  • This seems to work for me, and it's a simple formula. Scrap the Sine behavior. Add instance variables to your Sprite called XSpeed and TargetX.

    // Basic Formula
    Every Tick:
       Set X of Sprite to Sprite.X + Sprite.XSpeed*dt
       Set XSpeed of Sprite to (Sprite.XSpeed + (Sprite.TargetX - Sprite.X)*STIFFNESS_AMOUNT)/(1+DAMPENING_AMOUNT*dt)
    
    // Optional: Prevent Excess Wobble Near TargetX
    abs(Sprite.TargetX - Sprite.X) < 0.5
       Set X of Sprite to Sprite.TargetX
    [/code:6s2masrv]
    A good starting value for both STIFFNESS_AMOUNT and DAMPENING_AMOUNT might be around 5 to 10.
    
    Now I'm not sure if this is the "proper" way to do it, but it makes sense if you think about it. The further the object is from the target, the greater the force that needs to be applied to it, so we add a value to XSpeed proportional to its distance from the target. The stiffer a spring is, the HARDER it pulls an object towards it, so we multiply by the stiffness. Finally, springs slow down because of some energy lost in friction and whatever else. So we divide by some value over time.
  • Use Families. Add all your buttons to a Family. Add Family instance variables Enabled, Pressed/Clicked, etc. Also, add a 'callback' variable.

    Use callbacks to automatically go to a section of code (call a certain function) when a particular is button is clicked.

    Example:

    On Touched "Button"

    -- Call Function (Button.callback)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One thing I've done in the past (which you may have already tried): if the RUN animation isn't too long (less than half a sec before it loops), you could wait until it reaches its beginning (transitional) frame before stopping.

    For example:

    -- If Player is Stopped & RUN is Playing & RUN animation frame is 0

    ---- Set animation to STOPPED

    The issue with this is that he'll run a little in place before he becomes truly idle. The longer your run animation, the worse it'll look. Often times, you'll have multiple identical (or similar) frames in your RUN animation. If so, you can improve the result by testing to see if it's any of these frames rather than just the first one. If your player has deceleration (i.e He gradually comes to a stop when there's no input), then this could look pretty decent if you start the transition while he's slowing down.

    A more complex approach (just throwing it out there, don't know if it'll look good) would be to locate an appropriate transitional frame, and then animate the character towards that frame. For example, if the character's walk is 10 frames long, but he is two frames past the ideal transitional frame, reverse the animation, and then stop it once he's at the right frame. If, on the other hand, he is 8 frames in, let it play out until it loops. Find the closest distance and change the animation accordingly.

    Don't know if that gives you any ideas at all :P

  • You could try adding another spritefont object which contains the different frames. For example, you'll have SpriteFontStyle1 and SpriteFontStyle2.

    In game, place both objects in the same place. Manually toggle the visibility of both sprite font objects to achieve the animation you want.

  • Just throwing this out there. It looks like you intend for your code to only run once when the conditions are met, so why not use "Trigger Once" in your conditions?

  • I think I found a little hack you could use

    Array.Push(YourValue) // push a new element regardless of the comparison

    Array.Delete(Array.At(Array.Width-2) = Array.At(Array.Width-1) ? Array.Width-1 : Array.Width) // compare and delete if need be

    I might have screwed that up, but essentially you can exploit the fact that trying to delete an element outside of the array does NOTHING. So you can put your conditional in the delete event. If the comparison passes, use an index outside the array (so it won't delete anything). If it fails, then delete the element you just added by using the last index in the array.

  • You could use the Array.At(x) expression, where x is the index you'd like to get the value for and 'Array' is the name of your Array.

    Assuming you have a global variable called "CurrentIndex", you could do something like this:

    Every 30 seconds:

    -- Set text to Array.At(CurrentIndex)

    -- Add 1 to CurrentIndex

  • Hmm, I don't quite follow. This is the way I'm envisioning the basic events if you used a function. What will not work here?

    YOUR LOOP:

    For "" from x to y:

    -- Call "AddValue" (ArrayA.UID, ValueForA)

    -- Call "AddValue" (ArrayB.UID, ValueForB)

    -- Call "AddValue" (ArrayC.UID, ValueForC)

    YOUR FUNCTION:

    On "AddValue", Pick ArrayFamily by UID Function.Param(0)

    -- If ArrayFamily.Back IS NOT EQUAL TO Function.Param(1)

    ----- ArrayFamily.Push(Function.Param(1))

  • You can simulate adding/removing members from a family by adding a boolean to your family's instance variables called "Active". When you'd like to 'remove' an object from the family, set Active to False. To add it back again, set Active to True. To make this work, whenever you perform family specific events, add a condition to make sure that Active is True.

Dalal's avatar

Dalal

Member since 17 May, 2012

None one is following Dalal yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies