Started working with processing 2 days ago, works good so far. I'm trying to program a little game where you have to collect rectangles, and once you've collected all it should say "you win".
Well actually I'm stuck at the problem if how-to-detect if i collected a rectangle, but i think i got a solution. But that solution causes a Problem:
(My squares are called cows, cause i want to replace them with cow-pictures later on)
On the very top of my code i've put in this part:
// Für jede Kuh eine Variable erstellen und "F" setzen char A = 'F'; char B = 'F'; char C = 'F'; char D = 'F'; char E = 'F'; char F = 'F'; char G = 'F'; char H = 'F'; char I = 'F'; char J = 'F';
So this first sets the coordinates for the squares in 2 arrays, then gives each cow a "name", and then creates a variable for each cow that says "F".
I think so far ir should work.
Well, the fun starts at the draw-part. My idea is:
1. Check, if the mouse is in the 80x80-Area arround one of the squares
2. If thats the case, it should set the char-variable of the cow to "T" (for "True").
Now it should check if the char-variable is "F" or not. If its F, it should create the square, because i havent touched it yet. If its T, nothing should happen.
At the very last it should check if all char-variables are "T", if thats the case, it should print "Winner".
Well, i think this should work?
Now, my problem is that i dont know how to change the letter of the char-Variable using a for-loop. This is my try:
So, it pretty much repeates 10 times, and each time it takes the coodinates from the kord-array und checks if the mouse is there. If thats the case, it should get the "name" of the cow from the array above. that works (tryed it by printing the "g"-variable created.
But now i want to use the result of "g", which is, depending on the cow, "A,B,C,...J", whatever cow you hit. I want to update the char-variable created above from "F" to "T", so i can see wich cow was hit(T) and which was not(F).
Hello everybody. First of all, i am from Austria, so please excuse any mistakes i might make.
Well, last week i applied to an university, and now i got an Email with a little "home-work" to do. I guess they will look over it and if they like my game that would help me a lot for sure.
Well, we should make a game where you have to collecte 10 Rectangles, and once you've collected all the rectangles, you should get a "you win!"-Message.
Well, i don't think that this is gonna get that hard, but to make my game "shine over the others" i dont just want boring rectangles, i want cow's which you can collect with an UFO. But I'm stuck with the UFO-Part. How do i fix the ufo to my mouse?
I tryed to set rectangle mode to center, and created a 40x40 (thats the size of the ufo.png) rectangle. Then i tryed to set the position-data to mouseX and mouseY, like this:
rectMode(CENTER);
rect(mouseX, mouseY, 40, 40);
I put all of that into the void draw()-function, but now it creates 60 rectangles per second, and i think thats not how its intended to work best?
It would be better to create the rectangle first and just update the position with the draw-function, but i have no clue how to do that. Can you guys help me?
And i got another question: When i try to put the background-image intro the draw-function, it overwrites every "Cow-Square"(the orange ones). But when i put it into the setup-function, then i get thousands of the mouse-squares. Where is my mistake?
I hope you can help me and excuse me if this were dumb questions, you would help me alot! Thank you in adavance!