Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Greenbird

  • Rank
  1. Hi, I am currently programming in java and was wondering if anyone could help me understand how I could go about creating a simple walking animation from a sprite sheet. When the user pressed the left, right, down, or up keys the sprite moves in those directions and looks as if it were walking. If anyone can point me in the right direction it would be much appreciated.
  2. Greenbird

    Finding Coordinates in a JFrame

    Thank you phaelax, and rip off I apologize for not being clear Im actually using an image of a circle as I want to learn how to work with 2D images. Before posting I did what you stated by taking the size of the image and subtracting it from the width of the frame but, that didnt seem to bound it the image still went off the screen slightly. Does finding points to bound an image work differently? I appreciate the help.
  3. Hi, Im currently programing a simple circle in a (200 by 400) JFrame in java. Im having trouble bounding my circle within the JFrame meaning when I move it to the right Im not sure how I can keep if from moving off screen. I also am having trouble figuring out how to calculate different points within the JFrame meaning if I wanted to position the circle at the right side without having it go off screen how would I calculate that coordinate or if I wanted to position at the exact center of the JFrame how could I calculate that? Any help would be appreciated.
  4. Greenbird

    [Java] Setting the variables in 2 objects equal

    Hey Polar1080, Perhaps you are already aware of this and this is what you meant by the long way but, I believe an easy way you could implement what you are talking about is to create a new method in the Robot class say, called RobotsEqual(). Then in this method create new variables set them equal to each robot and then set the new variables equal to each other. When you want to have the condition that the robots are equal to each other then just call this method. Perhaps I do no fully understand the problem so if my solution is incorrect please excuse me for my stupidity lol. To better illustrate what I mean here is some sample code excuse my syntax errors I havnt used java in a while. setRobotsEqual(var 1, var 2) { var1 = this.Robot1.speed(); var2 = this.Robot2.speed(); var1 = var2; }
  5. Greenbird

    Timer Objects

    Ah I see now! thanks alot Erik I appreciate the help and input
  6. Greenbird

    Timer Objects

    @Eric im writing a standalone app and im using awt and swing atm
  7. Greenbird

    Timer Objects

    @Eric hey thanks for the reply I am not experiencing any problems, its not a matter of improving my code I just wanted to see if there was another way to control the movement of the animation without the use of a timer. After reading your comment what im understanding is that if I do not use a timer object then I would have to calculate the time that has passed and move the object within the animation accordingly? How exactly would I go about doing something like that? I figure I would just get the system time and update the vertical movement, is this a correct assumption? I guess to be more precise how could i create a gameloop to update the animation of the block? I appreciate the help
  8. Greenbird

    Timer Objects

    Hey everyone quick question ive been programming in java and I created a simple block animation where the block moves from the top of the window to the bottom and stops. The way the block moves is that I am using a timer object/class in order to control how fast it goes and to update and such. I was just wondering is there any other way of moving the block without the use of a timer object/class such as a while loop? Any help would be appreciated. If you need further clarification please net me know.
  9. Hey everyone just finished coding a tetris game, everything works but when i resize the window the logic doesn't transfer. I only solved for issues pertaining to a specific sized window. My question is how do i solve for the overall general case i.e. any size window. Im not sure on how to approach this problem any ideas on how to start would be greatly appreciated.
  10. Hey i took your suggestion and my code still works but now instead of new puyos being made at the same location, after puyos are deleted the puyos that are left over stay in the same position they where before anything was deleted, but when moving a puyo over them the puyo goes right through it and lands at the bottom on top of an invisible puyo piece. So now what happens is, is that the puyo moves down but the color stays at its previous location. Any suggestions on how i could go about fixing this? Id appreciate the help.
  11. Hey guys, im creating a puyo puyo game and after hours of trying to get puyos that were not of the same color to fall after others where deleted i have found that the reason it was not working was because of an error. I found the error but im unsure on how to fix it, the error concerns rotation. If you have not played puyo puyo, puyos fall in pairs like this: (1)(2) In the game you are able to rotate them as well like this: (1) (2) (2) or (1) and also rotate them to the side like this: (1)(2) or (2)(1). In my collision detection code i check to see if only one puyo has hit a stack of puyos like this :(1)(2) (1)(2) i also check to see if only one puyo has hit a stack like this: (1)(2) (1)(2) If this one puyo case happens if there is nothing underneath the puyo that hasn't collided with anything it falls until it reaches the bottom of the board or until it collides with another puyo. My problem is, is that when i rotate my puyo to say (1) (2) if it hits a stack like this: (1) (2) (1)(2) my code assumes its a one puyo case and the top puyo is deleted and when rotated to the bottom the top puyo is moved down and the bottom puyo is deleted. My question is, is that how do i differentiate between the two cases? Meaning if i rotate the puyo to the top and or bottom how would i have it know that it is a rotated puyo and that it doesn't meet the criteria of only one puyo hitting a stack of puyos. So that is would leave it alone and not delete the puyo either on top and or bottom. I appreciate any help i apologize for the lengthy question. Here is my code: // Here i check if whether underneath the puyo is not null meaning that there is something underneath it. if(puyolist[current[0].x/image_width][(current[0].y+DELTA_Y)/image_height] != null) { //i then check if there is nothing underneath the puyo connected to the other puyo // it should move down. while(puyolist[current[1].x/image_width][(current[1].y+DELTA_Y)/image_height] == null && current[1].y + DELTA_Y + image_height < MAX_Y) { current[1].y += DELTA_Y; } [Edited by - Greenbird on January 13, 2010 1:08:52 PM]
  12. Hey this is what my code is doing its moving whatever puyos where left over after deletion down but for some reason after deletion the puyo that was left over becomes invisible but it is still there so when something falls on top of it, it looks as if it is floating. //create a temp piece and initialize it to 1 int temp = 1; //check while y - the temp is greater than zero in other words while we are still // in bounds of the board while(y - temp > 0 ) { //check is there is something on the board if(puyolist[x][y-temp]!= null) { // move the puyo down puyolist[x][y] = new Puyo(puyolist[x][y-temp].color,x,y); //leave an empty space where the puyo was before it was //moved down puyolist[x][y-temp] = null; } //change state-move the puyo down temp++; } repaint(); } Here is a screen cap to show specifically what is going on in my game please click on the link below Thanks again for the help: Puyo Puyo [Edited by - Greenbird on January 11, 2010 3:05:53 PM]
  13. Hey thanks for the advice i was able to come up with a solution, it works but im having a problem. When the puyos delete the puyos that were not of the same color move down but there color is passed to the coordinates (0,0) the top left corner of the screen. So when another puyo falls into that space it stops on top of a blank puyo. I am not sure why this is happening i feel like there might be something wrong with my logic but if not then there is something else wrong with my program. Would you have any ideas as to why this could be happening? int temp = 1; while(y - temp > 0 ) { if(puyolist[x][y-temp]!= null) { puyolist[x][y] = new Puyo(puyolist[x][y-temp].color,x,y); puyolist[x][y-temp] = null; } temp++; } repaint(); }
  14. Hey thanks for the great advice i did pretty much exactly what you suggested but I havnt been able to get it to work. I check the board top to bottom, bottom to top, and left to right. I create to variable top and bottom and then I set them to equal the board height and either increment or decrement in order to go from top to bottom or bottom to top. I then check to see if top is less then bottom I then set (j) to equal the bottom and set it to less then top and then I increment (j). Then I set puyolist my puyo array to equal it self plus one in order to move the puyos down. I then set puyolist with the parameters of (i) and top to null and return. Essentially after the puyos are deleted the puyos should fall and then it should print in what column it was that the puyos had fallen. What happens is that it always prints out the columns even before deleting but it is not reading anything on the board it constantly prints zero for the columns top and bottom. Not sure if this makes sense but let me know if you need clarification any way here is what i have. Thanks. public boolean freeFall(){ int i, j; boolean freeFall = false; for(i=0;i<board_width;i++){ int bottom = 0; int top = 0; for(j=0;j<board_height;j++) if(puyolist[j] == null){ j = bottom; break; } for(j=board_height;j<0; j--){ if(puyolist[j]!=null){ if(i<0||j>MAX_X||i<0||j>MAX_Y) { if(puyolist[current[0].x/image_width][current[0].y/image_height + 1] == null && puyolist[current[1].x/image_width][current[1].y/image_height + 1] == null) j = top; break; } } } System.out.println(""+top+""+bottom); if(top <= bottom){ continue; } for(j=bottom;j<top;j++){ puyolist[j] = puyolist[j + 1]; } puyolist[top] = null; freeFall = true; } return freeFall; }
  15. Hey, sorry if my subject title doesn't make any sense but i am making a puyo puyo game and recently with the help of other forum members i was able to delete puyos of the same color. Now that they delete how would i go about having the puyos that are left over fall down to the bottom of the board or onto another puyo. I was able to come up with a solution but it ended up just deleting everything instead of moving things down. How exactly would i go about referencing the puyos that are left over after deletion and move them down? Id appreciate any help thanks again.
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!