Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by cptrnet

  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. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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
  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. 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.
  12. Cool, thanks for all the information. I will have to try that.
  13. 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.
  14. I am trying to learn generics but it gives me an error when I try to compile this code. It says <T>printScores(T[]) in ArrayTest cannot be applied to (int[]) printScores(testScores); ^ public class ArrayTest{ public static <T> void printScores(T[] scores){ for(T t : scores){ System.out.println(t); } } public static void main(String[] args){ int[] testScores; testScores = new int[4]; printScores(testScores); } } I know that I have a local array that doesn't have anything in it yet so I don't know if that's the problem or not, but I am sure it will be down the road. If anyone can help me I would appreciate it very much, Thanks.
  15. 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.
  16. cptrnet

    [java] generics problem

    It says not a statement. printScores<int>(testScores); ; expected printScores<int>(testScores);
  17. I have made a simple flash game where you mouse over a hamburger and try to keep it from hitting a person that will eat it. My physhics for the hamburger are horrible. I don't know any math really and it just keeps going in the same direction without any unpredicability. If you want to see the game its HERE Also here is my code for the physics. function sendSandwhichUp(){ if(sandwhich._y >= 0 && (sandwhich._y + sandwhich._height) <= 400) sandwhich._y -= 10; sandwhich._x += howMuchX; if(sandwhich._x <= 0){ howMuchX = 15; }else if(sandwhich._x + sandwhich._width >= 550){ howMuchX = -15; } localCount++; if(localCount == howManyTimes){ clearInterval(intID); goingThrough = false; } } sandwich is the object I am trying to apply phsysics too. howMuchX is how much for it to move left or right. it will always move up the same amount. localCount is how many times this function will be called until it reaches howManyTimes and then it will stop the function interval. goingThrough is a boolean which tells that the function is already going and you can't run it until it already has stopped. I was thinking that I could make a class or whatever and have velocities. Then depending on where you hit the sandwhich it will calculate the velocity. I guess thats the part I need help on. If anyone can help me or show me some math or some tutorials it would be greatly appreciated. Thanks.
  18. How would I know where the mouse is relative to the burger? Would I need to subract the width and height of the movie from both objects and then decide where the mouse is. If it's less than halfway move the burger right, if its more move the burger left. Also how much should I move the burger? Should I always apply gravity or when it is in the air do some velocity calculation? Can anyone point me in the right direction of where to learn the math for this specific problem. I have been around to math sites and I don't know what to look for.
  19. Can anyone help me out with some information? Even what to search for on google would help. Everything I search for I don't understand to even know if it's the thing I need. Thanks
  20. I have made a flash game and I need to send the high score. I already have the page in PHP to save the high score all I need to do is pass GET or POST variables. Can I use getURL? I dont want a new window poping open. Also it needs to have a referer come from my site. Does flash send what was the referer through getURL or is there some other way I can do this. The page needs to know it came from my site. If there are any suggestions it would be appreciated. Thanks.
  21. Their test app doesn't completely work it was giving some errors so thats why I tried commenting out the lines until I got to where it was fine and so I got to the first line where it includes the PHPObject.as It works fine in their app but in mine it gives that error above. I haven't found anything to say what to do. It's the first line of code in all their program examples. I can't post in their forums either because they are not accepting new accounts. Oh well, is there another way I can save the score with flash? Anyone? REVISED - I found out that they had there publish settings to Flash 6 and ActionScript 1. So I changed it and now it works. So I can only use those settings? [Edited by - cptrnet on May 16, 2006 11:17:14 AM]
  22. I have no clue what is wrong. I opened up the test flash movie that it came with and commented out all the lines but the top one #include "PHPObject.as" I did this with my test movie as well. It's funny there test movie doesn't give the error I poster above but mine does. I have no clue what to do. Is there something I am missing. Please don't tell me I have to include the path or something like in visual studio. Or include some library.
  23. I can't get that PHPObject thing to work. I have installed the extensions. But it gives me an error when I try to run the movie. PHPSerializer.as: Line 136: The property being referenced does not have the static attribute. if (v[a].__proto__ != Function.prototype) Total ActionScript Errors: 1 Reported Errors: 1 I am using Flash 8, could that be the difference because on the site it said it was using Flash MX, But doesn't 8 have backward compatibility? I don't know I am new to flash. Thanks for your help. Oh an all that my code is is this. #include "PHPObject.as" _global.defaultGatewayUrl = "http://localhost/classes/cTest.php"; _global.defaultGatewayKey = "secret";
  24. Ok I have coded my game to use LoadVars() but it only works if I am running the movie and pointing to my localhost. Such as http://localhost/index.php?action=3&gameid=11&score="+score+"&name="+txtName.text+"&level="+level but when I publish the movie it doesn't work and doesn't save the score. Then when I change it to my website it doens't work on either side, either the studio or the actual web page. It seems it only works in the studio and only if the url is localhost. Does anyone know what is happening and how I can get this to work? Thanks for any suggestions.
  25. cptrnet

    What gives us the right to eat other creatures?

    What gives your body the right to kill off those poor little infections and diseases? The right to live.
  • 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!