• 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.
Sign in to follow this  
Followers 0
mistervirtue

Code Help - Pong

9 posts in this topic

I think my errors have to do with with several of my SpriteManager (Which is a GameComponent) Fields

[CODE] Vector2 position;
Vector2 speed;
Rectangle screenRectangle;
Vector2 direction;[/CODE]

all have the same error, "is never assigned to and will always have its default value". But I do think I am assigning them each in my classes.

[CODE]
//This is My Computer Class Constructor Which Inherits from the BasePaddle Class
public ComputerPaddle(Texture2D texture, Rectangle screenBounds, Vector2 direction, Vector2 position, SpriteManager spriteManager)
: base(texture, screenBounds, direction, position)
{
this.texture = texture;
this.screenBounds = screenBounds;
this.direction = direction;
this.position = position;
this.spriteManager = spriteManager;
}
[/CODE]

[CODE]//This is my Player Paddle Class Constructor Which Inherits from the BasePaddle Class
public PlayerPaddle(Texture2D texture, Rectangle screenBounds, Vector2 direction, Vector2 position)
: base(texture, screenBounds, direction, position)
{
this.texture = texture;
this.screenBounds = screenBounds;
this.direction = direction;
this.position = position;
}
[/CODE]


So what I am i doing wrong? I don't know why my SpriteManager has null fields when I (I think) i am assigning them, I am sorry that I am asking so many questions, I don't have anyone other than you to ask.

So my question is why are my SpriteManager fields null? I don't understand what I am doing wrong/ I don't know what I didn't do. Edited by mistervirtue
0

Share this post


Link to post
Share on other sites
First question. Why are the private variables for the cpupaddle and the playerpaddle different? Secondly, we'll have to see how you are calling the two constructors to know why they are showing up null.
1

Share this post


Link to post
Share on other sites
First Answer. The Only diffrence is that CPUpaddle uses the spriteManager to find the ball position.

[CODE]
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(Game.GraphicsDevice);

Texture2D playerPaddleTexture = Game.Content.Load<Texture2D>("JongPaddle");
playerPaddle = new PlayerPaddle(playerPaddleTexture, screenRectangle, direction, position);

Texture2D computerPaddleTexture = Game.Content.Load<Texture2D>("JongPaddle");
computerPaddle = new ComputerPaddle(computerPaddleTexture, screenRectangle, direction, position, this);

Texture2D ballTexture = Game.Content.Load<Texture2D>("ball");
ball = new Ball(ballTexture, screenRectangle);

StartGame();
base.LoadContent();
}
[/CODE]

And that is how I call all of my classes. Edited by mistervirtue
0

Share this post


Link to post
Share on other sites
Are the JongPaddle images actually being found? IE. playerPaddleTexture != null? Also, where are you assigning or initializing screenRectangle, direction, and position?
0

Share this post


Link to post
Share on other sites
The JongPaddles are being found, but nothing else is. So I don't know what the issue there is. Also to answer your other question I think I am doing the assigning or intializing in the basePaddle Class.

[CODE]
namespace JONG_PongClone_
{
public abstract class BasePaddle
{
//Texture For the Block
protected Texture2D texture;
//position of the Block
protected Vector2 position;
//Directoin of the Block
protected Vector2 direction;
//Collision Rectangle for the block
protected Rectangle screenBounds;
[/CODE]
0

Share this post


Link to post
Share on other sites
All I see there are variable declarations. No initializations or assignments.

Show the code where you are actually setting the values for screenRectangle, position, and direction. Edited by Alpha_ProgDes
1

Share this post


Link to post
Share on other sites
That is my problem right there. I just realized I never assigned any value to my variables. That is problem I think. Thanks for kind of walking me through this.
0

Share this post


Link to post
Share on other sites
[quote name='Alpha_ProgDes' timestamp='1351213095' post='4993987']
All I see there are variable declarations. No initializations or assignments.

Show the code where you are actually setting the values for screenRectangle, position, and direction.
[/quote]

Okay I can't declare these values right. My screenRectangle is supposed to be my Window diminsions, my positions is supposed to keep track of the paddle location.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0