Merge 2 codes and improve my work

Hello !

This is for a school work.

I took someone’s code about dvdvideo meme (on OpenProcessing) and I improved it but really quickly.

However, I would like to get help to actually go further in the work to fill the required criteria (I have some) :

I have to include 1 array (at least), 6 variables (at least), at least one 2D shape, 2 conditions (at least), 2 loops (at least)…

Furthermore, with the teacher, we learnt some basics but I would like to edit his project with my idea and the already existing code for a new project including some sounds in it. His idea was to create a “bouncing” ball and we did so. And so did I with DVDvideo image. It works.

I’ve been on Discord, Reddit and so on, however, people only give me some limited help and unfortunately I don’t know where to find people who can seriously help me and “carry” me on to learn at the same time that they teach.

That’s the current code, I don’t know what I can improve. My latest problem has been tint, because when the image is bouncing on one of the 4 90° angle, I would like that the image gets randomly colored.

PImage DVDvideo;

float posX = random(0, 1920-453);
float posY = random(0, 1080-200);
float velX = (6);
float velY = (6);
float c1 = random (0, 255);
float c2 = random (0, 255);
float c3 = random (0, 255);

color colorA = color(random(255), random(255), random (255));

import processing.sound.*;
SoundFile startup;

void setup() {
  size(1920, 1080);
  DVDvideo = loadImage("DVD 453200.png");
  startup = new SoundFile(this, "Sound4.mp3");
  startup.play();
}

void draw() {

  background(c1, c2, c3);
  posX = posX + velX;
  posY = posY + velY;

 if(posX > width-453){
    velX = velX * -1;
  }
  if(posY > height-200){
    velY = velY * -1;
    }
  
  if(posX < 0){
    velX = velX * -1;
  }
   if(posY < 0){
    velY = velY * -1;
    }



 /* boolean hitCorner = false;
  //if (!hitCorner) {
    //posX == 2.1, width-451.1 && posY == 2.1, height-198.1;
    //{
      //hitCorner = true; 
      {
        if (posX == 2 && posY == height-198) {
          tint (colorA);
          velX = velX * -1;
        }
        if (posX == 2 && posY == 2) {
          tint (colorA);
          velY = velY * -1;
        }
        if (posX == width-451 && posY == height-198) {
          tint (colorA);
          velX = velX * -1;
        }
        if (posX == width-451 && posY == 2) {
          tint (colorA);
          velY = velY * -1;
        }

*/
        image(DVDvideo, posX, posY);
      }
     

So you want to create a DVD screensaver?

so you picked a bouncing object idea. That’s an image, not a shape (did the teacher mean a PShape?). Can you explain what the array will be used for ? what are the 6 variables for ? what are the loops going to do?

Actually he just said “a 2D shape” and that’s it. About the array, I have no idea. About the 6 variables, I have random color, pos and vel, looking for some more. Same for loops.

you have to come up with the ideas, we can’t do the homework for you…

I know right, that’s why I try to work on it…