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);
}