Skip to main content
deleted 24 characters in body
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

I'm developing a game in XNA(C#) and I wonder what are the best practices for having different types of pads for example. For example I have 2 types of pads:

  • First type for example willPad that just movemoves left (decreasing X coordinate)
  • Second type would movePad moves left and movemoves up and down (cos function on Y coordinate)

Later I would like to implement more pads. I know I could check type in UpdateUpdate method and do a proper method for updating but I think it could be done better. I have athe Pads class:

class Pads
    static list of pads;
    public void draw();
    public static void drawAll(); //Iterate through list and draw each item
    public void update();
    public static void updateAll(); //Iterate through list and update each item

shouldShould I create another class for example cosPad which would extend Pads?

I really don't have idea how to make everything logical.

I'm developing a game in XNA(C#) and I wonder what are the best practices for having different types of pads for example. For example I have 2 types of pads

  • First type for example will just move left (decreasing X coordinate)
  • Second type would move left and move up and down (cos function on Y coordinate)

Later I would implement more pads. I know I could check type in Update method and do a proper method for updating but I think it could be done better. I have a class:

class Pads
    static list of pads;
    public void draw();
    public static void drawAll(); //Iterate through list and draw each item
    public void update();
    public static void updateAll(); //Iterate through list and update each item

should I create another class for example cosPad which would extend Pads?

I really don't have idea how to make everything logical.

I'm developing a game in XNA(C#) and I wonder what are the best practices for having different types of pads. For example I have 2 types of pads:

  • Pad that just moves left (decreasing X coordinate)
  • Pad moves left and moves up and down (cos function on Y coordinate)

Later I would like to implement more pads. I know I could check type in Update method and do a proper method for updating but I think it could be done better. I have the Pads class:

class Pads
    static list of pads;
    public void draw();
    public static void drawAll(); //Iterate through list and draw each item
    public void update();
    public static void updateAll(); //Iterate through list and update each item

Should I create another class for example cosPad which would extend Pads?

I really don't have idea how to make everything logical.

Source Link

Best practices, extending classes

I'm developing a game in XNA(C#) and I wonder what are the best practices for having different types of pads for example. For example I have 2 types of pads

  • First type for example will just move left (decreasing X coordinate)
  • Second type would move left and move up and down (cos function on Y coordinate)

Later I would implement more pads. I know I could check type in Update method and do a proper method for updating but I think it could be done better. I have a class:

class Pads
    static list of pads;
    public void draw();
    public static void drawAll(); //Iterate through list and draw each item
    public void update();
    public static void updateAll(); //Iterate through list and update each item

should I create another class for example cosPad which would extend Pads?

I really don't have idea how to make everything logical.