Hey not sure if your still active on this forum but i was wondering if you could help me out i am currently in development of my own puyo puyo game and i could use some help if you can please reply back thanks.

Recommended Answers

All 4 Replies

Hey not sure if your still active on this forum but i was wondering if you could help me out i am currently in development of my own puyo puyo game and i could use some help if you can please reply back thanks.

Help can be given if you start talking in specific terms, however I do recommend that you start new thread and leave this relic

Oh hey my mistake i was replying to someone else i didnt realize i started a new topic but if you can help me id appreciate it. I already posted this question but i did not receive a reply. Anyway i was wondering how exactly could i load two images at the same time im making a puyo puyo game and like the game the balls fall two at a time any insight on how to do that. I figure i have to final int the number of balls dropping which would be 2 but then im not sure where to go from there. I appreciate any help

I guess you missed the "specific" part of Peter's post.

You load two image just like you load one, but you do it more than once.

See how that "specific" part comes into play?

Sorry about that thought that made sense oh well anyway here is my code in order to be more specific what im trying to accomplish is to have two puyo balls load at the same time and are connected to each other and the user is able to rotate and move them as if they were one object.

import javax.swing.*;
import java.awt.*;

public class DemoTest extends JPanel {
   
    public DemoTest() {
        add(new PuyoPanel());
    }
    
    
    
    
     public static void main(String[] args) {
	   
	  JFrame frame = new JFrame("Puyo_Puyo");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(270,600);
      frame.setResizable(false);
      frame.setContentPane(new PuyoPanel()); 
     // frame.setBackground(Color.white);
      frame.setVisible(true); 
     }
     
     

}//endclass DemoTest
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class PuyoAnimation extends JPanel {
	
	
  //private static final int SIDE = 30;
  private static final int MAX_X = 200;
  private static final int MAX_Y = 500;
  private static final int SPEED = 10;
  Image i0; // Declare a name for the Image object.
  Image i1;
  Image i2;
  Image i3;
  Timer pptimer;
   int x = 30;
   int y;           

   
    public PuyoAnimation() {
      super();
      
      // Load an image file into the Image object. This file has to be in the same folder
      i0 =  Toolkit.getDefaultToolkit().getImage("puyo_yellow.png");
      i1 = Toolkit.getDefaultToolkit().getImage("puyo_blue.png");
      i2 = Toolkit.getDefaultToolkit().getImage("puyo_green.png");
      i3 = Toolkit.getDefaultToolkit().getImage("puyo_red.png");
      setBackground(Color.white);
	  pptimer = new Timer(100, new TimerAction());
	  pptimer.start();
    }
    
    
    
    public void setAnimation(boolean OnandOff) {
        if (OnandOff) {
            pptimer.start();  
        } else {
            pptimer.stop();  
        }
    }

    public void paintComponent(Graphics g) {
    	super.paintComponent(g);
    	
    	// draw the "stop" line for the animation
        g.setColor(Color.black);
        g.drawLine(0, MAX_Y, getWidth(), MAX_Y);

    	// Draw our Image object.
    	//g.drawImage(image,30,30,30,30, this); 
    	g.drawImage(i0,x,y, this);
    	//g.drawImage(image1,40,30,30,40, this);
    	//g.drawImage(image2,70,70,70,70, this);
    	//g.drawImage(image3,80,80,80,80, this);
         
    }
    
    
   

    
    class TimerAction implements ActionListener {
    
       
        
        public void actionPerformed(ActionEvent e) {
          
         	y += SPEED; 
      if (y + x >= MAX_Y) { 
        setAnimation(false);      
      }
      repaint();

           
        }
    }
}//endclass
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


class PuyoPanel extends JPanel {
   PuyoAnimation pa;   
    
   
    PuyoPanel() {
      
        pa = new PuyoAnimation();        
        JButton startButton = new JButton("Start");        
        JButton stopButton  = new JButton("Stop");
        
    
        startButton.addActionListener(new Start());
        stopButton.addActionListener(new Stop());
        
       
        JPanel button = new JPanel();
        button.setLayout(new FlowLayout());
        button.add(startButton);
        button.add(stopButton);
        
       
        this.setLayout(new BorderLayout());
        this.add(button, BorderLayout.SOUTH);
        this.add(pa,BorderLayout.CENTER);
    }
    
    
   
    class Start implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            pa.setAnimation(true);
        }
    }
    
    
    class Stop implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            pa.setAnimation(false);
        }
    }
}//endclass
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.