Loading...
Logo
Processing Forum
pritima's Profile
3 Posts
5 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    I'm trying to create a game menu, so basically there's a start screen and your click the button to start the game...
    how do I have different states of the screen, suppose game menu is a state, play game is another state, and then game over is another state, how do I go about implementing those in my game. Would I use a case statement, if someone could me some guidelines on how to do this then that would be great.

    Thanks.


    Hello...
    Basically I'm trying to load images into two classes. Here is my code.
    I've managed to display a card using loadImage function. The next bit is how do I load two images that are assigned to the class.

    int maxImages = 52;
    int imageInd = 0;
    PImage[] images = new PImage [maxImages];
    Card[] cards;

    void setup(){
      size(150, 200);
      for (int i=0; i <images.length; i++){
        images[i] =loadImage(""+i+".png");
        //images2[i]= loadImage(""+i+".png");
      }
      //for (int i=0; i<images.length; i++){
    //cards[i] = new Card(x, y, images,[i], i);
        
      }

    void draw(){
      image(images[imageInd],0,0);

      
    }

    class Card {
      // displays the card
      PImage img;
      float xP;
      float yP;
      float size;
      boolean matchedPairs;
      boolean show;
      int imgInd;

      Card (float x, float y, float size, PImage img, int imgInd) {
        matchedPairs = false;
        this.xP = x;
        this.yP = y;
        this.size = size;
        this.img = img;
        this.imgInd = imgInd;
      }

      void pairs() {
        matchedPairs = true;
      }
      
      void showCard(){
        show = true;
      }

      void displayCard() {
        if (matchedPairs || show) {
          image(img, xP, yP, size, size);
        }
      }
    }


    Hi,
    I would like some tips on how to view images in a grid format in Processing? Would I use an ArrayList and store all the images in there or would I just use a for Loop. Please can someone advise me on the best way to approach this solution,

    Thank you.