Jump to content
  • Advertisement

cptrnet

Member
  • Content Count

    289
  • Joined

  • Last visited

Community Reputation

169 Neutral

About cptrnet

  • Rank
    Member
  1. cptrnet

    Using the this() keyword in java?

    The purpose of this() is to call an overloaded constructor. Although the example you gave doesn't really do anything. It sets the default variables but then sets them what is passed into the other constructor over again. This is what I would use it for. class Dog{ private int age; private String Name; private String Color; public Dog(){ //Default Constructor this(1, "Unknown", "Unknown"); //Calls overloaded constructor to set defaults } public Dog(int a, String n, String C){ age = a; Name = n; Color = c; } }
  2. Your GamePanel Class isn't adding the MouseListener and MouseMotionListener. You need somthing like this addMouseListener("whatever class implements MouseListener") and/or addMouseMotionListener("whatever class implements MouseMotionListener") What is the error you are getting when you try to implement these interfaces?
  3. cptrnet

    What should I name my game?

    Relentless: Sadistic Sanctuary Just when you think your safe, around the corner lies something so sadistic that it will hurt you, but the point is you think your safe Help Shout for help in this game when you find out your sanctuary has been overrun by relentless underground cave freaks.
  4. cptrnet

    Designing a menu system

    Yes I am trying to learn how to do this. Using other peoples code is great and I would like to learn from their code but finding code is the hard part. I would just like to find out how other people are doing this so I can at least make something simple. Thanks for the link.
  5. cptrnet

    Designing a menu system

    My question is about designing a Menu System. I listed some things I thought it should have and then asked if I should go through all the trouble of building a system or just make a different one per game meaning every game I make I write code for.
  6. Hello gamedev, I have tried to design a menu system and I think that I don't know what I am doing. First of all I made it in C++ but I would like to design something for any language. I just made it like the menus that windows use like Menu, Submenu, MenuItem type stuff. But I was thinking about how to make a menu appear on the main screen, like One Player, Two Player, Options, etc. And then for options it would be another menu. So I would have just two classes Menu and MenuItem. For menu I would have if it is active or not whether or not it renders. I would need it to have input so it would cycle through the menu items. And a command key to whether or not they select them item, that is just for the keyboard. The mouse would be easy, if they clicked on the menu item it would run the command for that item. Should I just start off with that? Am I going to far for something simple, I just want something that I can apply to all my games but a menu system is simple enough I think it doesn't have to have all this complicated stuff, I don't know. If anyone can give me some pointers it would be appreciated.
  7. cptrnet

    Gamedev Statistics

    Well I like things that are not trying to be funny. If there are people just posting some random thing trying to be funny or really stupid, unless it really is, then I'll just skip over it. Something like this Or This one
  8. cptrnet

    Gamedev Statistics

    Why do we only have statistics for things that are at the top. Why don't we have the worst rating or the stupidest post ever. One of the reasons I come here is to read posts in the lounge that are funny. I am trying to go through posts that people have made and see if there are any good ones. There is this one post where my friend was asking a question and the guy replied like this Quote:"DUH handle all the standard messages to be handled in the base class". And then he said Quote:"If you insist on saying "DUH", try to make a post that makes a little more sense" I don't know maybe I should be on the list for stupidest posts ever or maybe they want to make it a freindly place here and not exploit people for their inadequacies.
  9. I just wrote a function like this. void SysTray(bool enable) { enable ? Shell_NotifyIcon(NIM_ADD, &m_sysTray) : Shell_NotifyIcon(NIM_DELETE, &m_sysTray); } I don't know if this is how you do it really, but I just ADD it to show it and then DELETE it to hide it.
  10. First off I think I am going overboard with making everything a class. I have these two classes in sperate packages and they rely on each other, and that makes for tight coupling which is bad right? Well I can't think of any reason why I should do it another way. The two classes are for collision detection, well actually they are interfaces. Collideable and CollisionListener Here is my directory tree source | ------com | ------impulse | ----event | | | -----CollisionListener | ----geometry | -----Collideable And here is my source for the two files package com.impulse.geometry; import com.impulse.event.CollisionListener; public interface Collideable{ public boolean isCollideable(); public void isCollideable(boolean c); public boolean checkCollision(Collideable other); public void addCollisionListener(CollisionListener c); } package com.impulse.event; import com.impulse.geometry.Collideable; public interface CollisionListener{ public void collisionEvent(Collideable one, Collideable two); } So here is my question assuming you don't think what I am doing is bad, because I am not really that good and I think I cam going to crazy with classes and interfaces and whatever. How do I compile these two files? I have tried every way I can think of and it says they both need the other file to compile. So I thought I can compile them at the same time but I get an error C:\Java\engine>javac -d /class/ -cp /class/ C:/java/engine/source/com/impulse/ev ent/*.java C:/java/engine/source/com/impulse/geometry/*.java C:/java/engine/source/com/impulse/event/CollisionListener.java:21: error while w riting com.impulse.event.CollisionListener: \class\com\impulse\event\CollisionLi stener.class (The system cannot find the path specified) public interface CollisionListener{
  11. Cool, thanks for all the information. I will have to try that.
  12. I do have another question. Is this ok to use generics like this? I mean everytime I want to use the X and Y it has to autobox. Will that make things go slower than to create a concrete class that only accepts int's or double's or any primitive number? I guess it wouldn't be too bad to create a seperate class for each primitive there isn't that many. I don't know.
  13. Hello, I don't know if this is possible but I have this class to hold an X and Y value for a vector in two-dimensional space. I want it to be generic so I can have it be an Integer vector, or Double, or whatever kind of Number. Here is my class and my question. public class Vector2D<T>{ private T x; private T y; public Vector2D(){ //Add something here to set default X and Y } public Vector2D(T x, T y){ setX(x); setY(y); } public T getX(){ return this.x; } public T getY(){ return this.y; } public void setX(T x){ this.x = x; } public void setY(T y){ this.y = y; } } Is there anyway to have a no-arg constructor in this and have it set default variables? I have tried adding "this(0,0);" to call the other constructor but having that defeats generics. I don't want to always have to pass something in when I create a new vector. It's not like this is a big problem, it will only save me a couple keys strokes each time. Thanks for any suggestions.
  14. cptrnet

    [java] generics problem

    Quote:Original post by SiCrane Last time I checked, Java generics did not support primitive types, only things descended from Object. So no int. Okay so there is the answer right there.
  15. cptrnet

    [java] generics problem

    It says not a statement. printScores<int>(testScores); ; expected printScores<int>(testScores);
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!