Animation vs Movement - How to move obstacles?

Get help using Construct 2

Post » Sun Sep 16, 2012 1:14 pm

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:

Very quick and only for debugging, not perfect. The lines
[code]twig Set X to...
twig Set Y to...
twig Rotate 50 degrees...[/code]
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:
It is just a test project where nothing happens, it's only for testing of the twig rotation.Aeris852012-09-16 13:15:29
Posts: 12
Reputation: 374

Post » Mon Sep 17, 2012 3:29 pm

Posts: 12
Reputation: 374

Post » Mon Sep 17, 2012 7:38 pm

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)

podpathos2012-09-17 21:07:04
Posts: 96
Reputation: 1,583

Post » Tue Sep 18, 2012 9:14 am

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.
Posts: 12
Reputation: 374

Return to How do I....?

Who is online

Users browsing this forum: emoaeden, yurinkab and 21 guests