I'm trying to create buttons in which when the user mouses over the word, it changes from white to gray (the only word I have this applied to is "About". In theory it should change back to white once the mouse moves away from it, but for some reason it's staying gray. I think there's some small issue in there somewhere that I'm overlooking and I just need a fresh pair of eyes to find my mistake. Any help is greatly appreciated!!!
And my apologies for the tons of code in here. This is an in-progress class project.
// for this project, I'm creating a virtual tour of NIU's art museum along with pages with their information, mission statement and the Arts at NIU.
//For all my images and number values, I'm basing them off the DisplayWidth and DisplayHeight so that they will appear in the same location regardless of the size of the screen the program is run on.
//fonts
PFont arialBold;
PFont arial;
//Home page and exhibit integers
//this integer will organize all the pages for the home page (information, mission, ect.)
int home;
//this integer will organize all the pages for the virtual tour. The two different integers will ensure that the two don't get tangled with each other
So for a project, We need to make an interactive "kiosk" for a museum. Right now, I'm trying to make "dummy" code to reference to throughout my project.
I'm trying to use booleans to change "scenes" in the kiosk. (example: Start at an opening menu, click a button then go to a page for an exhibit) and so I'd be turning each scene on and off depending on how the user navigates.
For my dummy, I want to be able to click the rectangle and then go to a new scene with a white background.
Any help is greatly appreciated!!!
int ButtonX, ButtonY;
int ButtonSize = 50;
color ButtonColor, ButtonHL;
boolean ButtonOver = false;
boolean newScene = false;
//boolean Scene2 = false;
void setup(){
size(displayWidth,displayHeight);
ButtonColor = color(150);
ButtonHL = color(255);
ButtonX = width/2;
ButtonY = height/2;
rectMode(CENTER);
}
void draw(){
update(mouseX,mouseY);
if(newScene){
drawNewScene();
}
if(ButtonOver){
fill(ButtonHL);
}
else
{
fill(ButtonColor);
}
stroke(0);
rect(ButtonX, ButtonY, ButtonSize, ButtonSize);
}
void update(int x, int y) {
if(newScene){
if (ButtonOver(ButtonX, ButtonY, ButtonSize, ButtonSize)) {
ButtonOver= true;
}else{
ButtonOver = false;
}
newScene = false;
}
}
boolean ButtonOver(int x, int y, int width, int height){
if (mousePressed && mouseX >= x && mouseX <= x +width &&
I'm trying to create a simple simulation of a zombie appocolypse. There will be more people and zombies and hopefully a "zombie patrol" but I need to work this bug out first.
I want it so that if the "zombie" collides with the "citizen", the "citizen" becomes a zombie. The program won't let me convert one class into another and I tried displaying a new class but that won't work either.
Once I figure this out, this project should be all downhill from here! Any help would be GREATLY appreciated!!!
full code
// For this project, I want to simulate a zombie appocolypse. I will be using three objects to represent the zombies, average people and law enforcement.
//I want to make it so if a zombie touches (bites) a citizen, they will in turn become a zombie
//If a Zombie-Patrol person touches (shoots) a zombie, the zombie will die.
//if everything works properly, the game will end if everyone becomes a zombie or all the zombies die.
Zombie myZombie;
newZombie myNewZombie;
float zombieX;
float zombieXspeed = -.3;
float zombieY;
float zombieYspeed =-.3;
float zombieXspeed2 = -.1;
int zombieSize = 30;
Citizen myCitizen;
float citizenX;
float citizenXspeed = .3;
float citizenY;
float citizenYspeed = .3;
int citizenSize = 30;
void setup() {
size(500, 500);
//frameRate(30);
//randomize zombie location
zombieX = random(200,400);
zombieY = random(200,400);
//randomize citizen location
citizenX = random(20,355);
citizenY = random(20,355);
myZombie = new Zombie(zombieSize);
myCitizen = new Citizen(citizenSize);
//Zombie = ellipse(zombieX,zombieY);
}
void draw(){
background(0);
zombieX += zombieXspeed;
zombieY += zombieYspeed;
myZombie.display(zombieX, zombieY);
myZombie.display(zombieX+40, zombieY+40);
myZombie.display(zombieX+20, zombieY+20);
citizenX += citizenXspeed;
citizenY += citizenYspeed;
myCitizen.display(citizenX, citizenY);
myCitizen.display(citizenX-40, citizenY-60);
//scene wrapping for first zombie
if (zombieX > width + zombieSize/3){
zombieX = 0+ zombieSize/3;
}
if (zombieX < 0){
zombieX = width - zombieSize/3;
}
if (zombieY > height + zombieSize/3){
zombieY = 0+ zombieSize/3;
}
if (zombieY < 0){
zombieX = height - zombieSize/3;
}
if (zombieX+20 == citizenX+20 && zombieY+20 == citizenY+20){
myNewZombie.display(citizenX,citizenY);
citizenXspeed = -zombieXspeed;
citizenYspeed = -zombieYspeed;
}
}
zombie class
class Zombie { //class name
int r; //float zx, zy;
Zombie(int tempR) {
r = tempR;
}
//methods
void display(float zx, float zy) {
//Zombie;
fill(0,200,0);
ellipse(zx, zy, 20, 20); //zombies will be represented by green circles
}
}
citizen class
class Citizen { //class name
int rc; //float zx, zy;
Citizen(int tempRc) {
rc = tempRc;
}
//methods
void display(float cx, float cy) {
//Zombie;
fill(241,217,120);
ellipse(cx, cy, 20, 20); //zombies will be represented by green circles
}
}
attempted "New Zombie" class
class newZombie { //class name
int rnz; //float zx, zy;
newZombie(int tempRnz) {
rnz = tempRnz;
}
//methods
void display(float nzx, float nzy) {
//Zombie;
fill(0,200,0);
ellipse(nzx, nzy, 20, 20); //zombies will be represented by green circles
I have to create an interactive poster for my interactive art class and the main element is (obviously) text. I feel like I'm doing everything correctly, I'm not getting any errors, but when I run the code all I get is a white screen. I'm thinking there's some weird syntax error in there somewhere that I'm missing, but hopefully a fresh pair of eyes will help me find it.
And for anyone who's curious, we need to make a poster about an event on our campus (I go to Northern Illinois University) and my poster is for auditions for the Silverettes dance team.