here's issue. have paddle class , ball class. both have update, initialize, , draw methods. issue paddle class. want draw 2 paddles on screen (each different color), code have doesn't work correctly. result 4 paddles instead of 2 (basically 2 paddles, 2 more underneath).
here's code - http://paste2.org/p/1390842
and here's screenshot of problem - http://img651.imageshack.us/img651/9092/pongshot.png
i'm unsure of i'm doing wrong. perhaps it's case of not being able draw 2 different paddles? should make second paddle class instead?
and here's game1.cs file - http://paste2.org/p/1390854
and ball class - http://paste2.org/p/1390856
inside intialize/draw methods drawing 2 paddles 1 object. change these this:
public void initialize(texture2d texture, vector2 position) { pongpaddle1 = texture; //set paddle position paddle1position = position; } public void draw(spritebatch spritebatch) { spritebatch.draw(pongpaddle1, paddle1position, null, color.darkslateblue, 0f, vector2.zero, 1f, spriteeffects.none, 0f); }
basically rid of paddle2 class. since creating 2 instances of paddle in game1.cs don't need have 2 draws inside paddle. kind of defeats purpose of data objects. each instance inside game1.cs call draw() method , draw themselves.
Comments
Post a Comment