Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
milou.dieteren
milou.dieteren's Profile
2
Posts
2
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
I'm trying to add sound..
[1 Reply]
30-Jan-2013 01:19 AM
Forum:
Core Library Questions
hello everybody,
i'm trying to add sound to my game but it's saying:
Null pointer exception
i don't know what's wrong with it. can someone help me?
thanks in advance.
this is my game:
int knopX = 510;
int knopY = 420;
int breedte = 100; //beginscherm
int hoogte = 100;
boolean schakel;
boolean over;
int score =0;
PFont lettertype;
PImage background2;
PImage start;
import ddf.minim.*;
Minim minim;
AudioPlayer player;
buster buster1;
Enemies spook1;
Enemies spook2;
Enemies spook3;
Enemies spook4;
Enemies spook5;
Enemies spook6;
Enemies spook7;
void setup () {
size(900, 800);
buster1 = new buster(30, 540, 4);
spook1 = new Enemies(random(0, width), 0, 3);
spook1 = new Enemies(random(0, width), 0, 2);
spook2 = new Enemies(random(0, width), 0, 5);
spook3 = new Enemies(random(0, width), 0, 2);
spook4 = new Enemies(random(0, width), 0, 6);
spook5 = new Enemies(random(0, width), 0, 4);
spook6 = new Enemies(random(0, width), 0, 6);
spook7 = new Enemies(random(0, width), 0, 4);
background2 = loadImage("background4.png");
start = loadImage("beginscherm.png");
lettertype = loadFont("AbadiMT-CondensedLight-48.vlw");
player = minim.loadFile("GhostBusters.mp3");
minim = new Minim("GhostBusters.mp3");
player.play();
}
void draw() {
image(start, 0, 0);
fill(0, 0, 0, 0);
stroke(0, 0, 0, 0);
rect(knopX, knopY, breedte, hoogte);
if (mouseX > knopX && mouseX < knopX + breedte && mouseY > knopY && mouseY < knopY + hoogte) {
fill(0, 0, 0, 0);
rect(knopX, knopY, breedte, hoogte);
over = true ;
}
else {
over = false;
}
if (schakel == true) {
image(background2, 0, 0);
textFont(lettertype,25);
fill(0,255);
text(score+" ghosts caught",50,50);
buster1.tekenBuster();
buster1.beweegBuster();
spook1.tekenEnemies();
spook1.beweegEnemies();
spook1.checkEnemies();
spook2.tekenEnemies();
spook2.beweegEnemies();
spook2.checkEnemies();
spook3.tekenEnemies();
spook3.beweegEnemies();
spook3.checkEnemies();
spook4.tekenEnemies();
spook4.beweegEnemies();
spook4.checkEnemies();
spook5.tekenEnemies();
spook5.beweegEnemies();
spook5.checkEnemies();
}
}
void mousePressed() {
if (over==true) {
schakel = !schakel;
}
if (over==false) {
}
}
void stop()
{
player.close();
minim.stop();
super.stop();
}
key pressed problem
[5 Replies]
11-Jan-2013 06:44 AM
Forum:
Programming Questions
hello,
for school i have to make a game but i'm having difficulties with the keyPressed function.
i'm trying to move an object to the left with te left button on the keyboard.
below shows what i have so far ( i left out the part that draws the monster)
thanks in advance for you help
class Monster {
int x;
int y;
int speed;
Monster(int tempX, int tempY, int tempSpeed) {
x = tempX;
y = tempY;
speed = tempSpeed;
}
void beweegMonster() {
if keyPressed () {
if (key == 'left') {
x = x + speed;
}
}
}
}
«Prev
Next »
Moderate user : milou.dieteren
Forum