• 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.


  • Content count

  • Joined

  • Last visited

Community Reputation

147 Neutral

About JDCAce

  • Rank
  1. I have a functional pong game, and I'd like to add powerups (such as increase paddle size). I've created a Powerup class, and I'd like to let it handle all the powerup business. However, I'm not sure how to let my Powerup class see the variables of one of my Paddle class objects. That is, I'd like to use [b][font=courier new,courier,monospace]paddleLeft.height += paddleLeft.Height[/font][/b][font=arial, helvetica, sans-serif] in my Powerup class to double the size of the left paddle (but leave the right paddle alone). However, paddleLeft [/font][font=arial,helvetica,sans-serif]is an instance of my Paddle class, and it's made in my Game1 class. Is there a way to let my Powerup class know I have a paddleLeft instance, and give my Powerup class access to its variables? I could add parameters to the Powerup constructor, but that doesn't seem efficient. Is there another way?[/font]
  2. I've built a basic pong game, but I'd like to add powerups that will increase or decrease paddle size or ball speed, or do other stuff. However, I'm having trouble coming up with how to implement them in a object-oriented way. Should I make a Powerup class? How do I make different instances have different effects?[font=courier new,courier,monospace][font=arial,helvetica,sans-serif] Should I create a separate class for each type of Powerup?[/font][/font]
  3. I think I'm starting to understand. Thanks!
  4. I am still perplexed by the use of the "static" keyword. I have read that a static method can be used without creating an instance of the class that contains it, but why is this beneficial? I think an example would really help my understanding. Also, what is the purpose of a declaring a variable as static when the method was not declared static (if there is a purpose)?
  5. I agree, ShadowValence. I worked on my coding and I think it's a lot cleaner and a bit more efficient now. Like I said, I found the math elsewhere, so I won't claim that as mine, but after a lot of working, I think I understand it. Also, as EngineProgrammer suggested, I made only one Rectangle per paddle (and one per ball), and saved the values in the respective class (ie, leftPaddle.rectangle). I added an Update() method to the Paddle class in which the values of the rectangle are updated, using rectangle.X and rectangle.Y, instead of creating a whole new rectangle each Update(). This project really has turned out to be a valuable learning experience, and I can't thank all of you enough! [rollup='Code'][CODE] private void checkHit() { float intersectY = ball.location.Y; float relativeIntersectY; float normalizedRelativeIntersectY; double bounceAngle; if(leftPaddle.rectangle.Intersects(ball.rectangle)) { relativeIntersectY = (leftPaddle.location.Y + (leftPaddle.Height / 2)) - intersectY; normalizedRelativeIntersectY = (relativeIntersectY / (leftPaddle.Height / 2)); bounceAngle = (normalizedRelativeIntersectY * (Math.PI / 4)); ball.velocity.X = (float)(10 * Math.Cos(bounceAngle)); ball.velocity.Y = (float)(5 * -Math.Sin(bounceAngle)); } else if(rightPaddle.rectangle.Intersects(ball.rectangle)) { relativeIntersectY = (rightPaddle.location.Y + (rightPaddle.Height / 2)) - intersectY; normalizedRelativeIntersectY = (relativeIntersectY / (rightPaddle.Height / 2)); bounceAngle = (normalizedRelativeIntersectY * (Math.PI / 4)); ball.velocity.X = (float)(10 * Math.Cos(bounceAngle)); ball.velocity.Y = (float)(5 * -Math.Sin(bounceAngle)); ball.velocity.X = -ball.velocity.X; } } [/CODE] [/rollup]
  6. Thank you very much, EngineProgrammer! I think this will still be tough, but you've given me a great head start! [b]UPDATE:[/b] It works! Using some math I found elsewhere, I got my program to run flawlessly! Now for my next project: Randomly-dropped power-ups!
  7. Thanks a bunch for the help, guys! Looking at it now, yes, the Rectangles should be created only once. That wasn't a very good idea on my part. As for you suggestion, EngineProgrammer: [quote name='EngineProgrammer' timestamp='1348926458' post='4985043'] - The ball has a velocity(X,Y) and a position(X,Y) as type: double or float. Each update you do m_Position += m_Velocity; So the ball moves depending on his velocity. - Create 1 Hitregion(Rectangle) for 1 paddle - When the hitregion of the paddle and the ball return true... - Calculate a vector from the center of the paddle and the center of the ball. - Merge that vector and the velocity of the ball. - (This depends on how the vector is calculated) you might need to reverse the X-value of the new velocity so the ball goes the other way. [/quote] ... I don't know what a vector is. (I know what a vector in physics is, but I don't know anything about them in gaming/programming terms.) I'll go look it up and try out your suggestion! However, what do you mean "merge the vectors?" Is merging something I'll learn about when looking up vectors? Also, in response to Pyrodrgn, I do have a Paddle class and a Ball class. I'm still getting used to making my own objects like this, and I'm still not very good at deciding what each class should be in charge of.
  8. [b]EDIT:[/b] I have solved my problem. All I needed was to change the send and third [b]if[/b]s to [b]if else[/b]s. If anyone could tell me [i]why[/i] this is, I'd love to know. I've made a simple pong game, using Rectangle.Intersects(Rectangle) for hit detection. However, I'd like some more variability, so I want the ball to move differently depending on the spot on the paddle it was hit. [i][Ball movement has an XSpeed value and a YSpeed value, and each Update the ball moves along the X-axis a number of pixels equal to XSpeed; ditto for Y-axis and YSpeed.][/i] This is what is intended: If the ball hits the top third of the paddle, YSpeed decreases by 1. If the ball hits the middle third of the paddle, YSpeed doesn't change. If the ball hits the bottom third of the paddle, YSpeed increases by 1. If the ball hits any part of the paddle, the XSpeed is reversed. However, since I subdivided the paddles into three Rectangles, hit detection no longer functions properly. The ball changes direction only if the middle third of the paddle is hit, and the ball just flies through the top and bottom thirds. This is really weird. I can not find the error. I've gone over the code several times, but I'm just stuck. [source lang="csharp"]private void checkHit() { Rectangle paddle1RectTop = new Rectangle(paddle1.X, paddle1.Y, paddleTexture.Width, paddleTexture.Height / 3); Rectangle paddle1RectMid = new Rectangle(paddle1.X, paddle1.Y + paddleTexture.Height / 3, paddleTexture.Width, paddleTexture.Height / 3); Rectangle paddle1RectBot = new Rectangle(paddle1.X, paddle1.Y + paddleTexture.Height * (2/3), paddleTexture.Width, paddleTexture.Height / 3); Rectangle paddle2RectTop = new Rectangle(paddle2.X, paddle2.Y, paddleTexture.Width, paddleTexture.Height / 3); Rectangle paddle2RectMid = new Rectangle(paddle2.X, paddle2.Y + paddleTexture.Height / 3, paddleTexture.Width, paddleTexture.Height / 3); Rectangle paddle2RectBot = new Rectangle(paddle2.X, paddle2.Y + paddleTexture.Height * (2/3), paddleTexture.Width, paddleTexture.Height / 3); Rectangle ballRect = new Rectangle(ball.X, ball.Y, ballTexture.Width, ballTexture.Height); Boolean hasHitPaddle1Top = paddle1RectTop.Intersects(ballRect); Boolean hasHitPaddle1Mid = paddle1RectMid.Intersects(ballRect); Boolean hasHitPaddle1Bot = paddle1RectBot.Intersects(ballRect); Boolean hasHitPaddle2Top = paddle2RectTop.Intersects(ballRect); Boolean hasHitPaddle2Mid = paddle2RectMid.Intersects(ballRect); Boolean hasHitPaddle2Bot = paddle2RectBot.Intersects(ballRect); if(hasHitPaddle1Top || hasHitPaddle2Top) { ball.XSpeed = -ball.XSpeed; ball.YSpeed = ball.YSpeed - 1; } if(hasHitPaddle1Mid || hasHitPaddle2Mid) { ball.XSpeed = -ball.XSpeed; } if(hasHitPaddle1Bot || hasHitPaddle2Bot) { ball.XSpeed = -ball.XSpeed; ball.YSpeed = ball.YSpeed + 1; } }[/source]
  9. Those sound like good starting points. Thanks for the help! I just Googled procedural map generation, and it looks just like what I needed.
  10. I've decided to make a clone of the open-source Android game [url="http://www.aopensource.com/index.php?more=30"]Scrambled Net[/url], but with XNA and for PCs. (Basically, you have one "power node" and have to rotate wires so all computers are connecting to the power node.) So far, I've been able to put random tiles on the board and have them rotate when clicked. Now comes the daunting task of the puzzle logic. I thought it would be easier to put a "solved" puzzle on the board and simply rotate the tiles randomly from there. (The user will not be able to see the solved state, of course.) That means all the necessary tiles are in their places; the user just needs to rotate them correctly. But I'm stuck: How do I generate a "solution?" I don't even know where to begin. Is this project too complicated for a beginner? Should I pick something simpler, like tic-tac-toe?
  11. I haven't read either of them, but I am currently reading [url="http://www.amazon.com/The-Art-Game-Design-lenses/dp/0123694965"]The Art Of Game Design[/url] by Jesse Schell. I highly recommend it. (..though I don't know what's in the two books you bought, so I don't know if there's overlap or conflicting advise.)
  12. Hello, everyone. I'm new to the site as well as to game development. I was curious as to how I create my own sprites, such as a spaceship for a shooting game I would like to make. I've tried using Paint in the past, but Paint saves the whitespace around the image as part of the image. Is there a free tool out there that allows me to draw without worrying about the surrounding whitespace?