Is there a way to hide joptionpane message box. I want to hide this box each time the player dies and the game restarts. I don't wanna use controlP5 method to create message box. It is too much coding for nothing.
void MsgBox() {
javax.swing.JOptionPane.showMessageDialog(null, "<html>My Breakout Game Remix<br>INSTRUCTIONS<br> 1.Avoid hitting with the balls at all cost.<br> 2.If you die. It's game over.<br> 3.You will be asked for number of balls input, When you will die.Challenge yourself with more balls.");
Like my title says i wanna add scoring and sound when ball hitting the brick and also when ball hits ground the game ends. Any help would be apprieciated.
/********************************************************************************
Defintion of the Paddle Class:
The Paddle Class is used to define the Paddle object in the game.
It makes use of the Rectangle Class.
*********************************************************************************/
Hi guys i wanna map my game mod remix on each side of the 3d box and any help would be appreicated. I am using an internal library called lightGL but i don't know how to map it on the each side. Also how would i go by adding sound each time the ball hits the brick?
/**
* LightsGL.
* Modified from an example by Simon Greenwold.
*
* Display a box with three different kinds of lights.
*/
import processing.opengl.*;
void setup()
{
size(1024, 768, OPENGL);
noStroke();
}
void draw()
{
defineLights();
background(0);
for (int x = 0; x <= width; x += 100) {
for (int y = 0; y <= height; y += 100) {
pushMatrix();
translate(x, y);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(90);
popMatrix();
}
}
}
void defineLights() {
// Orange point light on the right
pointLight(150, 100, 0, // Color
200, -150, 0); // Position
// Blue directional light from the left
directionalLight(0, 102, 255, // Color
1, 0, 0); // The x-, y-, z-axis direction
// Yellow spotlight from the front
spotLight(255, 255, 109, // Color
0, 40, 200, // Position
0, -0.5, -0.5, // Direction
PI / 2, 2); // Angle, concentration
}
when the game start i want the ball to be sticking to the paddle and when mouseclicked it shoots and when it comes back it sticks again. For this do i have to put an if statement in the collisiondetection with the paddle?
here is my code remix
Hi all, I am doing a remix on game mod and i want to show 2 spinning or on mouse x and y box showing the game mod remix in each of it's sides. How can i do this? I know there is an example of box on mouse x and mousey in the examples library but how can i showing it each the breakout game mod in each of its side.
OR
how can i make a 3d box of my game mod remix and it's rotationing?
Like the title says how can i disperse video image cell when i press the mouse button and when i press it again they come back to their original state? Is this possible?
This is the code i am using from the library.
import processing.video.*;
// Size of each cell in the grid
int cellSize = 15;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device
Capture video;
void setup() {
size(630, 480, P2D);
//set up columns and rows
cols = width / cellSize;
rows = height / cellSize;
colorMode(RGB, 255, 255, 255, 100);
rectMode(CENTER);
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, width, height, 15);
background(0);
}
void draw() {
if (video.available()) {
video.read();
video.loadPixels();
// Begin loop for columns
if (mousePressed) {
background(random(255),random(255),random(219));
for (int i = 0; i < cols;i++) {
// Begin loop for rows
for (int j = 0; j < rows;j++) {
// Where are we, pixel-wise?
int x = i * cellSize;
int y = j * cellSize;
int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image
// Each rect is colored white with a size determined by brightness
I have a checker board that i would like to the following. I just stuck and i don't wanna spend more time thinking about. I would appreciate any help.
a. Make the cells toggle between moving and not as the user clicks. First click = move; second click = stop; third click = move; fourth click = stop; etc.
b. Make the cells bounce off the edges of the canvas instead of sailing off into infinity.
c. Note that some cells never move. Fix that, so that all cells move.
here is my code and how do i bounce the pulse of array of the canvas. Also how can i make this draw inifinite forever and ever.
// ----------------------------------------------------------------------
// CUSTOM CLASSES
// ----------------------------------------------------------------------
//Pulse is a class that draws a pulsing dot on the screen
class Pulse {
/* properties */
int SCALE = 50;
int x; // x-coordinate of the pulse
int y; // y-coordinate of the pulse
float s; // size of the pulse
color myColor = color(255,255,255); //default color
/* methods */
// constructor 1
public Pulse(int pulseX, int pulseY) {
x = pulseX;
y = pulseY;
s = 5;
}
// constructor 2
public Pulse(int pulseX, int pulseY, int pulseScale) {
x = pulseX;
y = pulseY;
SCALE = pulseScale;
s = 0;
}
// constructor 3
public Pulse() {
x = 0;
y = 0;
s = 0;
}
// constructor 4
public Pulse(int pulseX, int pulseY, int pulseScale, color newColor) {
x = pulseX;
y = pulseY;
SCALE = pulseScale;
s = 0;
myColor = newColor;
}
// moves the pulse to the given position
void move(int newX, int newY) {
x = newX;
y = newY;
}
// draws the pulse and updates its size
void display() {
fill(myColor);
stroke(0);
ellipse(x, y, sin(s)*SCALE, sin(s)*SCALE);
s += 0.1;
}
}
// ----------------------------------------------------------------------
// GLOBAL VARIABLES
// ----------------------------------------------------------------------
int numPulses = 550;
//counter tracking how many pulse objects have been istantiated
int pulseArrayCounter = 0;
//create of any array type pulse pulse array with 1000 elements
Pulse[] pulseArray = new Pulse[numPulses];
Hi i am this assignment where i have to draw 3 brushes on mouse dragged and they should alter between 1 2 and third brush as i am dragging my mouse. I know it sounds simple but i racking my brain to sort this out but i am having difficulty doing this part. Here is my code. I need help asap.
Hi like the title says i need to draw a head nose and mouth in one function. I am still new to processing and i get concfused very easily with all the vars and in doing so i get lost what i want to do. my head function is very basic but i wanna use better code for drawing my head a nose and a mouth. My head function only draws the head i dunno why it's not drawing the mouth and the nose when i call the head function in the void setup. here is my code.
Also i have to Rewrite
drawHead() so that it will accept two arguments which specify the position at which the head is drawn then i have to draw the head in three places on the display. Please reply asap. I really need help with this.
void setup() {
smooth();
size(500,500);
drawHead(250,350);
drawHead(400,120); // draws head at specific pos
drawHead(120,120); // draws head at specific pos
drawEyes(380, 100);
drawEyes(100, 100); // draws eyes at specific X .Y pos
}
// Function that draws head with eyes, mouth and nose
void drawHead(int xPos, int yPos) {
int headSize = 100; // var for the headsize
int mouthX = 100; // var for the x pos of the mouth
int mouthY = 125; // var for the y pos of the mouth
int mouthWidth = 100; // var for the mouth width of the mouth
int mouthHeight = 40; // var for the mouth height of the mouth
// booleon mouthTrue = true;
fill(255,216,0); // applies colour to the head
ellipse(xPos,yPos,headSize,headSize); // position of the head
line(113,130,125,130); // position of the first coordinate for the nose
line(113,130,120,135); // position of the second coordinate for the nose
line(120,135,125,130); // position of the third coordinate for the nose
noFill(); // applies no fill to the mouth
arc(mouthX,mouthY,mouthWidth, mouthHeight, PI/6,PI/2 ); // position of the mouse
}
void drawEye(int xPos, int yPos, int eyeSize) {
// set the fill to white
fill(255);
// draw the white of the eye
ellipse(xPos, yPos, eyeSize, eyeSize);
// set the fill to black
fill(0);
// draw the black pupil
ellipse(xPos, yPos, eyeSize/2, eyeSize/2);
}
void drawEyes(int xPos, int yPos) {
// specify the size of the eye
int eyeSize = 20;
// specify the gap between eyes
// base it on the size to ensure enough space
int gap = eyeSize*2;
drawEye(xPos, yPos, eyeSize); // draw the left eye
drawEye(xPos+gap, yPos, eyeSize); // draw the right eye
}