and what I want is, add a method to the Ball class to detect whenever a ball colides with another one and do something simples, like change teh ball fill color.
Also, i'm seeing this weird behaviour when the balls hit the edges of the screen, not sure whats happening.
I've trying export my sketch it works fine on my laptop (Mac OS X). However when i sent it to a friend, he claims that the app runs but nothing happens besides the menu bar (top left corner) changing to the name of my app and thats it. Nothing works.
Im using 2 .wav and 2.png files that aren't inside that ".app" package. However i tried copy pasting the data folder inside the package (Contents/Java/data) and still doesn't work.
I've been practicing some OOP and OpenCV with processing and i've been doing ok so far.
This sketch is working and its a Work in Progress.
Im drawing the Blobs and i want to have a picture fall from height = 0 width = random and when it collides with a blob, i want it to jump up and start falling again, and so on.
My Questions are:
How do I code the colliding of the picture and the blob? You can recommend some examples and i'll try to learn from them :)
and
How would you code Gravity in such a way that, when colliding with a blob i would just use a method like move(Speed, Angle, Acceleration); and the image would rise till speed = 0 and fall again until it hits a blob or y = height.
keep in mind that i really want to understand the code so if you point me to some documentation / tutorials / examples or even some commented code i'll be glad :)
Im praticing my Object-Oriented Programming with a simple program that lets me control a "car" (its actually just a rect()).
So far i have the car being displayed and moving. But i want to make it a bit more "natural" to drive the little square.
At the moment i just have "if key W is pressed, X++ / if key S pressed X-- / if A angle++ / if D angle--" this is a really simple translation and rotation of the shape.
I'd like to use W / S to move the square always forward and backwards having in mind the front and back of the "car" and A / D would rotate the "car". THis way i could actually control the "car" in a more natural way.
Here's what i've got so far: (Keep in mind this is really basic and primitive stuff :X)
Car car;
void setup(){
size(400,400);
car = new Car();
}
void draw(){
background(200,210,200);
//DRAW THE SHAPE
car.display();
//CONTROL THE CAR WITH KEYBOARD (W,S,D,A)
if(keyPressed) {
if (key == 'w' || key == 'W') {
car.forward();
}
}
if(keyPressed) {
if (key == 's' || key == 'S') {
car.backward();
}
}
if(keyPressed) {
if (key == 'a' || key == 'A') {
car.left();
}
}
if(keyPressed) {
if (key == 'd' || key == 'D') {
car.right();
}
}
}
class Car{
float speed, posX, posY, w, h, angle;
Car(){
posX = width/2;
posY = width/2;
w = 30;
h = 10;
speed = 5;
angle = radians(90);
}
void display(){
rectMode(CENTER);
translate(posX, posY);
rotate(angle);
rect(0, 0, w, h);
}
void forward(){
posX += 5;
}
void backward(){
posX -= 5;
}
void left(){
angle += radians(15);
}
void right(){
angle -= radians(15);
}
}
Since im going to be doing alot of this kind of programming (much like programing a game) i'd probably be better with reading about this theme.
I'll be needing Gravity , Inertia, Collision and so on to make the controls more fluid and natural.
I've been trying a few keywords on google but not getting where i'd like.
Maybe some of you can suggest a good book or anything at all i can start reading :)
I just installed OpenCV 2.2, the OpenCV Processing Library, and the examples.
Im getting the usual "cannot find dependencies" errors everyone else got with version 1.0 and so on.
Its almost 2011 and the problem presists even with OpenCV 2.2.
I have the SYSTEM PATH variables correct, and im using Windows 7 64bit.
heres the error message:
"
!!! required library not found : C:UjfgDesktopSoftwareProcessing e OpenCVprocessing-1.2.1librariesOpenCVlibraryOpenCV.dll: Can't find dependent libraries
Verify that the java.library.path property is correctly set and the 'path oOpenCVin' exists in your system PATH
"
Any idea how to fix this? Its about time things work out of the box.
im trying to learn OOP and giving my first try with processing.
My goal is to make a falling image affected by gravity. However im trying to make it generic enough so i can make anything fall, be it an image or a video.
So i made:
a "Container" class that will receive an object
a "Image" class that will receive a directory and some other arguments
a "Video" class (yet to be implemented).
My problem is, i dont know how to send an Object to the Container class.
Im also getting token errors on all the arguments of the constructors of each class.
heres the code:
void setup(){
size(800,800);
background(0);
content = new Image("image.jpg", width/2, height/2, 400, 400);
block = new Container(content, width/2, height/2, tempW, tempH);
}
void draw(){
block.display();
}
class Container {
int containerPosX, containerPosY, containerW, containerH;
I want to build an Automated Sentry Gun like www.thesentryproject.com but using Processing.
For the Motion Tracking, I downloaded the OpenCV Library that will (i hope) help me out with the detection of movement and targets.
My question is, where can i find the reference manual for the library? I know of
http://ubaa.net/shared/processing/opencv/ but is that all the functions we can use? is there a manual with all the functions and examples? I also bought the "Learning OpenCV - O'Reilly" book. But since its all C / C++ its not of much use if i cant find the similar functions for OpenCV Processing Library.