Rolling ball - Texture question

Get help using Construct 2

Post » Mon Apr 23, 2012 12:07 pm

I'm wondering how I would make a texture on a rolling ball so it seems to be 3d.
For example in the game of Pool. When you shoot the cue ball at the eight ball.



I my case it would be a 2d top view of the table but if this effect would work, the game would look more natural instead just moving some circles around the table.

Any thoughts? eski2012-04-23 12:08:45
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Mon Apr 23, 2012 4:50 pm

I'm not at home to check C2's capabilities, but methinks the way to do this would be to have an sprite detector, and on top of that have a tileable background with an "unwrapped" ball texture and display it at an offset based on the balls movement. But then to make the tileable background a round shape... need another brain for that one.
B
51
S
13
G
8
Posts: 194
Reputation: 7,311

Post » Mon Apr 23, 2012 5:20 pm

[QUOTE=eski] Any thoughts? [/QUOTE]

Demo

I was making a game for "Reclamation" contest till I went crazy and formatted my PC with all files including capx.

If it is effect you are looking for, just make an animation of rolling texture and manipulate it with angles.
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Tue Apr 24, 2012 1:48 am

Ok, this is exactly the effect I'm looking for. It really looks nice btw :) Still not quite sure how to set it up.
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Tue Apr 24, 2012 4:01 am

It looks like animated frames by Blender3D or some 3d editor. You can make a sphere, then apply a texture, then render and get animated frames, it's easy.
B
95
S
25
G
20
Posts: 3,052
Reputation: 22,613

Post » Tue Apr 24, 2012 1:43 pm

[QUOTE=eski] Still not quite sure how to set it up.[/QUOTE]

Example

capx

Sprites are generated using 3d software. And in Construct 2 animation speed is constrained to ball's velocity. If you use physics or other mechanics, just calculate ball's speed and set it as animation speed.
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Wed Apr 25, 2012 5:10 am

@Kastas

I like your example.
Have been trying to change it to physics behavior because it is much more real when it comes to, well Billiard physics (back bounce of rail and what not).. :)

There is no option to get pure speed from the physics behavior, just X and Y Velocity.
I tried to use the custom movement behavior along with the physics to get the speed but it doesn't read the physics.

What I would to do is to have the ball react naturally when it hits the rail, texture vise.. It will probably take more events then the bullet behavior thingy. Was a bit surprised how easy that was btw. :)
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Mon Apr 30, 2012 4:22 am

Now I have been trying to get this to work properly, not successful!.
Anyway, here is a cap.

http://dl.dropbox.com/u/4436588/pool2.capx

Why can't i make the animation go faster without the whole thing lagging?

Why can't i use really high animation speed, like 100-200. Do i need to change the sprite's time factor or what?

Also, I'm trying to figure out the best way to make the texture react "real" when it bounces back from the wall. The animation always plays the same way though the "cue stick" hits it from another angle.
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed May 02, 2012 11:16 am

So I wanted to bump this.

I found out that it is not possible to use animation speed with a physics sprite, it stops and well just doesn't work.
So the best way regarding that is to have a physics sprite working as a placeholder for a another sprite that will have all the texture movement and what not.

But still, I haven't found a good way to make the ball roll realistic regarding speed and when it bounces back from the bumper.
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Fri Aug 10, 2012 5:51 pm

Sorry for deleting the last post, but I thought of something else to check, and it made my post inaccurate.

Anyways... good news is that what I came across here, makes what I was trying to accomplish a lot easier.

You can calculate angle of movement and then apply force to adjust for the object it is colliding with. Like if a cue ball hit a bumper you could apply additional force with the angle of movement.

Here is a pic of my event:


Here is how I calculated the angle:
angle(0,0,Sprite6.Physics.VelocityX,Sprite6.Physics.VelocityY)

I apply force in the direction my object is moving on collision and it gives my object an extra boost.

At least, I think this is what you are looking for.

Hope it helps.
B
16
S
1
G
3
Posts: 43
Reputation: 2,597

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests