jobel's Forum Posts

  • what movement type does your player have?

    are you using platform behavior?

  • Hi, I've been working on this a few days now and just can't figure it out. I need another set of eyes..

    The Goal: I have a 2D sprite that is drawn as if 3D. It's a space ship and I want it to fly in, towards the "player's view" as if this were a camera view.

    I am trying to slowly increase the size of the sprite, as I move the sprite towards the right side to give an optical illusion of it coming closer to you.

    the sprite is angled 3/4 view and facing 4 o'clock-ish.

    I start the sprite at 0.1 scale xy: 160,150 then increase size using lerp and dt. While at the same time setting it's position using lerp moving towards 640,350.

    My Problem: I can't get it to look right. And it seems awkward to increase the sprite's position while I'm checking for max size which always equates to the sprite never reaching it's position.

    I've played around with the variables, and I can get it to go in a "straight line",sort of, but I can't slow it down. I feel like I might be going about this the wrong way.

    I've been playing with the last parameter of Set Position's lerp. but it's not making that much of a difference. And if it's set too low I get a swooping effect (since I know lerp can give a deceleration 'look' used that way). So I tried applying that logic to Set Scale but it's not working like I would expect.

    I know this is tricky..can anyone help me identify the variables I need to balance in order to make this look right? (Since I will probably have other sprites drawn at different angles I need to know how to balance growth-rate vs movement.

    Thanks in advance!

    capx

  • this works..

    Hi,

    I don't mean to step on toes but unfortunately Sprite doesn't have a scale expression. So here are the steps to get the effect you want.

    1. Add an instance variable to your sprite, call it "myscale" and give it an initial value of 0.1.

    2. Add an event with the "compare instance variable" condition and set it up as follows:

    Sprite: myscale<1.0
    ---> Sprite: add 1.0*dt to myscale
    ---> Sprite: set scale to myscale

    Note, the first action is the "add to" action under "instance variables" and the 2nd action is "set scale" under "size & position".

    This will need some tweaking to make it happen in one second. As it is now the expression 1.0*dt can be read as 1 per second, but we're going from 0.1 to 1.0 in a second, or just 0.9 in a second. So it should be like this:

    Sprite: myscale<1.0
    ---> Sprite: add 0.9*dt to myscale
    ---> Sprite: set scale to myscale

    Another thing you can deal with if you like is what I like to call over shooting. With this event the end scale will likely be a bit more than 1.0. You can use the min() expression to limit the highest value to 1.0 and set up your event like this:

    Sprite: myscale<1.0
    ---> Sprite: set myscale to min(self.myscale + 0.9*dt, 1.0)
    ---> Sprite: set scale to myscale

    As a final note you can make the duration longer or shorter by tweaking the dt expression.

    half second:

    2*0.9*dt

    two second:

    0.5*0.9*dt

  • Another thing you can deal with if you like is what I like to call over shooting. With this event the end scale will likely be a bit more than 1.0. You can use the min() expression to limit the highest value to 1.0 and set up your event like this:

    Sprite: myscale<1.0
    ---> Sprite: set myscale to min(self.myscale + 0.9*dt, 1.0)
    ---> Sprite: set scale to myscale

    to clarify incase people got stuck like me...

    use "Set value" instead of "Add to" while using the min()

    or you could just easily use the min() expression on the Set Scale, but probably cleaner to have the instance variable have 1.0 when the sprite is at it's 1:1

    thanks R0J0hound

  • sorry! I meant to link that to JJList

    I download the capx link...

  • Burvey re: your capx, if the sprite is not square it will distort. The aspect ratio of width and height cannot increment at the same rate.

    my sprite was 100x60 and grew distorted (flat looking) and then when it approached full size it finally stretched out to normal, but the transition is not what the OP is talking about.

    I'm still looking for the best way to do this.. probably scale? If I find out I will post it here.

  • okay thanks!

  • right, you could nest it.. I was just wondering if there is a way to do it on the same level... I guess not?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • is it possible to mix ORs with ANDs in C2?

    i.e.

    If Keyboard Spacebar OR Gamepad button 0 pressed AND GunReady is True

       Then Spawn Projectile

    Else

       Countdown Reload etc..

    I'm basically trying to add controller support..

  • no my card is running webgl fine. the main problem I am seeing is when I preview in C2 using Chrome i get a higher fps than if I export it to Dropbox and play it via the shared link. Not sure why this is...

    Any clue?

  • yes it does.. in the browser it runs faster if I make the window smaller..

    and I just made this a node-webkit and it's only running at 24fps. it's probably my video card...

  • last night I was getting only 30 fps, and this morning I am getting 45 fps.. still it's jumpy, which is why I put the ship in there...

    the fact that it changed does that mean it's a browser or internet issue?

  • I'm doing game dev on an older computer, but when I run this test I only get 30fps.

    all it is, is a space background 1920x1080 exported as JPG %75 (in the image format dialog box) so the size ends up only being 277KB (from 3MB). But something about the size is slowing down my framerate. I read in the doc that large files only effect download speed not runtime performance... so I'm confused.

    export

    In my full game that I am working on, I have 100+ events, collision detection etc.. and it runs at 60fps.. but when I add the nice space background it runs awful (in preview mode anyhow and dropbox). I ran a test exporting it using Node-Webkit and it seemed to run fine at 60 fps.

    I'm just trying to determine if it's my older computer, or if there is a limitation here, or it's an a browser issue. My computer is from 2006: dual core pentium 3.2Ghz, 4GB RAM running XP. The video card is very basic: ATI Radeon x500 256MB

  • Loki2020

    nano second or 2 making it look jumpy.

    not a nano second.. a millisecond!

    I have an older computer, but when I run this I only get 30fps.

    capx

    When my full game that I am working on has 100+ events, collision detection etc.. and runs at 60fps.. but when I add the nice space background it runs awful (in preview mode anyhow).