Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411588 Posts in 69386 Topics- by 58443 Members - Latest Member: Mansreign

May 06, 2024, 02:13:15 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)2d tennis game
Pages: [1]
Print
Author Topic: 2d tennis game  (Read 1165 times)
Sigma
Level 1
*


View Profile WWW
« on: May 10, 2010, 09:32:26 PM »

hi,
  Any one have technical idea about a 2d tennis game in flash? i mean the math behind for creating the illusion of z depth or what should i google for?

Thanks in Advance
Logged

Hayden Scott-Baron
Level 10
*****


also known as 'Dock'


View Profile WWW
« Reply #1 on: May 11, 2010, 02:09:09 AM »

One of the easiest ways is to compute all your tennis gameplay on a flat 2D field, and then convert the positions when you draw it.

Perspective is just a trapezium, so you need something like this:

fakePositionX = realPositionX * ((realPositionY * 0.2) + 0.Cool;  // indent the X position more towards the top.
fakePositionY = realPositionY * 0.75; // squish the Y position.

With the ball, be sure to draw the shadow in the precise position, and the ball should be above that.
Logged

twitter: @docky
st33d
Guest
« Reply #2 on: May 11, 2010, 02:10:11 AM »

^ what he said kind of:

Think back to your perspective drawing class (everyone's usually had one) and consider 1 point perspective.

If you place the vanishing point in the center of the screen and drew lines in, you would notice that the distortion of x on to the y axis and vice versa can be calculated as a gradient. If you can calculate the slope that defines the vanishing point, you've got yourself a nice lazy way of calculating the scale of objects on the z axis.

There's probably a smart way of doing it, but that's what I would start with, seeing as it sounds like you don't need full 3D.

And what happened to the generative project you were doing?  Undecided
Logged
Sigma
Level 1
*


View Profile WWW
« Reply #3 on: May 11, 2010, 05:59:07 AM »


And what happened to the generative project you were doing?  Undecided

sorry i dont understand what u mean?
Logged

st33d
Guest
« Reply #4 on: May 11, 2010, 07:21:22 AM »

whoops - got you confused with nikki  Durr...?
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic