• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

2D angles and Paddle-ball sliding...

2 posts in this topic

actually, in pong like games, the angle at which a ball is deflected isnt merely an angle of incidence/angle of reflection thing. if it were, it would be really boring, because the ball would ALWAYS travel in the same 4 directions.

in pong, what is normally done is that the point of the ball hitting is compared to the center. the closer to the center, the closer to the 90 degree angle the ball is deflected. farther means an angle closer to 30 (or whatever you pick as the low end)

0

Share this post


Link to post
Share on other sites
2) how to convert that angle to x,y velocities

that's simple:
let's say your ball has the position x/y and the angle ang (in degree!).
0° is up, 90° is right and so on

Now you can move your ball this way:

int ang, v;
float x,y;
do {
//move
x += v*sin(ang*0.0174);
y -= v*cos(ang*0.0174);
//display or whatever ...
}

this is simple trigonometry:

/|
c/ |
/ |b
/w |
-----
a

sin(w) = b/c cos(w) = a/c
and as you can see, a is your dx, and b is dy.

last thing: I multiplied w with 0.0174 to convert it from degree to radiants.

I know, this code must be optimized, because
it has many floating point numbers in it
(even x and y are floats), but I think, it
answers your question.

good luck ...

Philippo

------------------
Philippo
s_buschmann@gmx.de
http://privat.schlund.de/Gerio

0

Share this post


Link to post
Share on other sites
I'm creating a Pong clone just to learn some basics about DirectX and general 2D game programming. Now, i would like to add a 'spin' to the ball if the player moves the paddle when the ball hits it. I need to know two things for this:

1) how to i figure out the new angle the ball should move in
2) how to convert that angle to x,y velocities

For the ball i want to have various speeds so i set up a speed variable that i multiply by the xv and yv variables to get the x and y increments. so I need the xv and yv variables to be 1 or below or -1 and above (obviously)

please help me. I've been trying to figure this out and i know trigonomitry is involved, but i haven't learned trig yet...

Bill(c)

0

Share this post


Link to post
Share on other sites