Animation vs Movement - How to move obstacles?

0 favourites
  • 4 posts
From the Asset Store
Obstacle Impacts and Cartoon voices, will makes your game more funny!
  • Hi community!

    I am about to make a bottom-top running game where a chameleon runs up a tree and has to avoid twigs. You can run on different lanes of the tree.

    But I'm not moving my character, but the background, so it's all just about perception.

    Initially, I only "teleported" my twigs around the tree on left arrow/right arrow. Now I want to animate them so they smoothly turn around the tree.

    My question is: Do I use animations, or real movement for the twigs?

    My first try were animations. But the disadvantage I see: While the "turn" animation is running, the animated twig is still logically at its starting position, and thus you can still collide with it although it visually is about to turn away.

    On the other hand, regarding movement: which behaviour should I give my twigs? They shall turn by 90? to the left or right, depending on which key is pressed and at which position the twig currently is.

    "Bullet" would be wrong because I need a curved path. "Car" and "8 direction" doesn't seem to be right either.

    This is my current animation implementation:

    <img src="http://ramenchan.files.wordpress.com/2012/09/twigs-animation.jpg" border="0">

    Very quick and only for debugging, not perfect. The lines

    twig Set X to...
    twig Set Y to...
    twig Rotate 50 degrees...

    are currently not synched with the animation. So the animation ends in another state than these 3 lines. I had to correct that, of course.

    Here is my capx:

    AnimationTest.capx

    It is just a test project where nothing happens, it's only for testing of the twig rotation.

  • Pretty-please-push!

  • here is a quick and drty example, with some suggestions for animations of tree and background via moving tilebackground.

    for each tree you need

    variable start.x at the center of screen

    variable start.y at some negative value

    start.angle (random of 360)

    and then you position each tree on elispe:

    tree.x is start.x+cos(start.angle)*width.of.tree

    tree.y is start.y+sin(start.angle)*(width.of.tree/2 or width.of.tree/3, or something else but les than width.of.tree)

    set tree.angle to angle(start.x, start.y,tree.x,tree.y)

    when you press left/right you add/substract value of start.angle for each tree - so each tree rotates

    of course you add some vaule each tick to start.y to move trees down at some speed

    here you go

    look at my idea for moving background I think it would suit you game (by the way i like your game concept)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, this looks awesome, thank you very much!!!

    I'll have a deeper look into it this evening, and it might take me a day or two to answer here how (or if) I could implement your suggestions in my system. Because I really want my character to run in lanes, and not completely free in 360 degress like you did it. So I still need to make some adjustments.

    Your moving background looked very interesting as well (I'll have to look into sooooo many things *g*).

    PS: Thanks for the praise! Unfortunately, there is already such a game out ("Nuts!", on iPhone) that works just like your implementation with 360 degree free running. If I had any chance to prove this, I'd add that I had this idea before those other developers published their game, and there are SO many ideas that are exactly the same, it's really a shame or irony of fate -.-

    I want to finish my project idea with the chameleon nonetheless, for personal track record.

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