Sprite Movement: Optical Illusion

0 favourites
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • 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

  • Hi,

    difficult.

    In my opinion its to short of a way from left to right to increase the size that much.

    I'd go play around with it moving faster than it's growing and maybe giving the layout more width so it has some space to move and grow.

  • If you have assets this good, why are you making a 2D game? 3D assets in 2D games pretty much universally look bad in my experience.

    Sorry for not directly answering your question but I think what you have now is probably the best you'll get in a purely 2D engine.

  • sqiddster

    no, this isn't my asset.. it's just downloaded from the web. But I will have art like this in my game. And I'm not treating it like a game asset really, it's for cut scenes.. so it will be totally scripted.

    similar to this:

    watch 1:49

  • sorry, watch 1:55 ...that space rock with an engine strapped to it.. it's basically the reverse motion that I want.. it gets smaller and moves slightly to the left.. it's an optical illusion that "pushes it back".

    yeah no 3D games for me just yet! haha

  • In my opinion its to short of a way from left to right to increase the size that much.

    5Type

    thanks, I'm thinking the same.. I just don't think I have the math right.. the 2 (size and position) are related..when I change to other values it just gets worse...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All right, fair enough.

    Still, I don't see what's wrong with what you have. Is it just too fast?

  • yeah it's too fast and the ratio is off.. I feel like the math is wrong because it just doesn't look right. It should look as if the ship were flying toward you.. and currently it looks more like it's just getting bigger.. something is off, but when I tweak the numbers it doesn't change much. I can't get it to grow any slower by changing x * dt.

    I've done exactly what I am trying to do in animation programs.. I just never had to do the math for it.. and really this is just a proof of concept. It may be that I can't do cut scenes like this...although I would really like to... but first I need to know how to automate sprites movements!

  • Is this better??

    copy.com/3Ivz1xValXo0

  • jobel I believe Imchucho's example already looks a lot better - still being a little off. Just thought it might have something to do with the perspective of the ship sprite. The example would look tons better if the sprite graphic was more heading toward to screen. Being like this it also moves down a bit as it should be scaling from the middle. Try playing around with its origin point.

  • Is this better??

    https://copy.com/3Ivz1xValXo0

    yes the end is better.. but it is still growing to fast at the beginning of the sequence..

    I appreciate you giving it a shot!

  • The example would look tons better if the sprite graphic was more heading toward to screen.

    yes it's hard when this is just temp-art since the angles are not totally what will end up in the game. But I'm trying to get the sprite movement figured out.

    All I really want is to be able to time size growth with movement. And for both of them to be steady. I think lerp is causing a curve in the Set Position, but it kind of works for a deceleration.. so I added lerp to the Set Scale but it doesn't seem to be the same.. of course it isn't the same..so that I think causes the ship size to be off from it's movement.

    Here is the scene so far..still needs a lot of work!:

    (it's all temp art and temp music)

    https://dl.dropboxusercontent.com/u/36234790/CutScene1.1/index.html

  • Well, I was playing around with it this afternoon too... it is hard to get it moving just right!

    I ended up double scaling the ship to keep it smaller longer, which I think helps.

    I am sure there are mathematical formulas to calculate the movement properly in a 3d space and then map that to the screen but I didn't have the time to figure that out. Oh, I also added sine motion to the ship after it stops to make it look like it is floating...

    you can see my version at: http://www.rieperts.com/games/Ship/

    and get the capx at: http://www.rieperts.com/games/Ship/sprite_movement.capx

    Good luck with your project - it looks great so far! :)

  • If I were you I'd have a look at the LiteTween plugin.

    Seems to me it could be very usefull in cases like these.

  • Well, I was playing around with it this afternoon too... it is hard to get it moving just right!

    I ended up double scaling the ship to keep it smaller longer, which I think helps.

    Thanks I like what you did there.. but somehow the beginning isn't right again.. although since you put that sphere below, that adds some sort of optical illusion which is pretty interesting!

    It may be that cut scenes are too hard to do with 2D images drawn as 3D and moving them. Not impossible, but definitely a lot of work to make it look right!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)