#Invitation to play my game. Thank you if you helped me. You know who you are.
127 messages · Page 1 of 1 (latest)
My latest commit to github.
I am very proud of it. I am self teaching and I feel this is some real progress.
I know it is rough around the edges.
Fun game! My best time is around 90 seconds and my highest enemy count was about 9 or 10. One thing I noticed: Occasionally, my score indicator will disappear., It happens more often when I shoot an enemy very quickly into the game.
Great job tho!
@quartz burrow I noticed that too. I'm am not sure why. LOL
I have two bugs. Solving one creates the other.
The change is here.java void removeHitEnemy(ArrayList<Enemy> enemy_list) { int lastIndex = enemy_list.size() - 1; for (int i = lastIndex; i >= 0; i--) { if (enemy_list.get(i).hit() == true) { enemy_list.remove(i); enemies_killed++; //println("enemies_killed......." + enemies_killed + '\n'); } } }
If I change java i >= 0;
to thisjava i > 0;
The score will no longer disappear, but the first enemy will not be removed because the only index is 0 and not greater than 0. I like the first enemy killed. This is desired result. I can remove the score but I want the visual for the player.
So why the heck would the score not draw to the screen. Intermittently at that. If I keep an enemy on the screen, like you mentioned, and dont kill them too quickly the score will vanish less. Sometimes it wont vanish at all. show_score() is a member of the Enemy class.
This is the interesting part of programming.
I do notice that Processing has a bug or two. Sometimes I need to restart a game a couple times to get the inputs to work. That hasnt happened in awhile now. Didnt happen at all yesterday.
Now I am just going to focus on making what I have better. I do not follow the DRY rule very well. I dont need to set textSize as much as I do. I am cleaning up that stuff today.
I think I found an easier solution. I simply made show_score() a global method (a method/function outside of any class) and then I called it at the end of play() rather than any enemy method.
This way, it always happens last so nothing can be drawn on top of it
I was thinking it needed to come out of the class.
You could also make this method inside the Game class if it's easier. Might feel more organized that way
True. It is part of the game I guess. It works perfectly.
I was playing around with the bullet_color variable and it doesnt seem to do anything lol I changed it to color(255, 0, 0) (red) and the bulets were still white
I have been cleaning up the code, adding some color and fonts to the text.
ah thats nice
Sorry that I keep pointing these things out. I really am happy for your progress, you did a good job here.
I asked for opinions and input. I am just figuring it out. It works but I know there are more professional ways
haha yeah, but don't stress too much on making it perfect
bullet_color is overwritten when the bullet is added. I set it to 255. If you look in the addBullet() method it is set there.
I was playing with it working on collisions.
oh yeah
Trying to decide if I wanted the bullet to know it hit an object or if I wanted the enemy to know it was hit. I decided on the latter.
btw since you extended the PVector class, you dont have to declare x and y
I still need a collision between enemy and ship, but Im cleanin it up.
I did learn that part way through my project.
I didnt see the harm in leaving it.
fair
I wrote it initially without PVector. I have learned a TON working on this project.
I see. You've made a lot of progress
The collision between the bullet and the enemy is all me. DerMorzi helped with the actor collision.
I tried to emulate his/hers and I was unsuccessful. Mine gave me a junk variable. I told you about my revelation the other day. It is similar to his/hers but different.
Yeah
boolean actor_distance(Actor opponent) {
float dist = PVector.dist(this, opponent) - (this.size/4 + opponent.size/4);
//println("opponent distance..........." + dist);
return(dist <= 0);
}```
This is how he did it.```java
void collision(ArrayList<Actor> Actors){
collision = false;
for ( Actor Actor : Actors) {
if (Actor == this) {
continue;
}
if (!collision && actor_distance(Actor)) {
collision = true;
}
}
}```
Why does it subtract that second half
The biggest difference is the objects are in the same list and mine has two different lists
distance math
subtracting the length from x and y
Is actor.size the diameter of an asteroid? Because I've done the math for the distance between 2 circles before, and I think they're colliding when the distance is less than the sum of their radii
when it is inside the length it is colliding
Yes
PVector.dist() does most of the work.
So size / 4 seems like half of the radius
It is. It makes the best collision. Otherwise they arent touching when they collide. I just played with values.
I usually do this differently, but I see now its very similar to how I would have done it. To me, it doesn't make sense to subtract from the distance because then the variable no longer represents the distance. It now represents the distance minus the radii. I would have left it at dist = PVector.dist(this, opponent); and then return dist < size/4 + opponent.size/4;
That way it more accurately represents what you're doing
Interesting way to look at it.
It is really which more closely communicates what you want.
exactly
I have learned programming is getting alot out of the fewest instructions
Sometimes yeah, but it's also important to be clear about what you're doing. After all, you can write code that does the job in only a few lines, but you might not be able to understand it when you read it again a week later.
I am attempting to learn C++ from Programming: Principles and Practice using C++ Bjarne Stroustrup's book. He stresses this very concept.
I use Processing to learn the concepts because it is more friendly but it does help with C++ concepts.
Java is text based. C++ is more symbolic.
Oh definitely. The key concepts definitely transfer across all languages
I like the fact that with Processing I can immediately see the effect on the screen. I swear to god if I had this when I was in high school Geometry would have been f**k'n easy.
I went to high school in the mid 80s
Yes! I actually did have Processing in high school, it's great
But yeah it helps to visualize things
Where are you on this big blue marble? Im in Michigan, USA.
I'm in southern USA
Well nice to meet you. Most people dont gab much.
You work as a programmer/programming capacity?
Oh, I wish. I'm currently attending a local community college for a degree in Game Design. I hope to someday be a game developer.
I deal with ladder logic. I work in maintenance and PLCs. I just read it and see what is going on. I dont write it.
I believe I could write it using concepts I learn in Processing and C++.
Oh, that's cool!
If you're learning C++ you should also check out arduino microcontrollers. They're fun to play with
asorry
once sec
Arduino is what introduced me to C++.
ohh, neat
All the wiring slowed me down. Processing doesnt have any loose wires to deal with.
I spent alot of time finding hardware issues.
Arduino is inspired by Processing, which is pretty cool
Arduino was the gateway to a much bigger world.
I tihnk processing has hardware support now
Arduino has a discord server that is quite active. I ask c++ questions there sometimes. They have all kinds of support.
Awesome!
I am in 3 servers. This one, Together C & C++, and Arduino.
A nice trio
I only read most of the time.
Yeah, me too. I'm in the server for the Godot game engine and I sometimes listen in on the voice channels. Someday I'll say something...
I had Godot for a bit but it was over my head. I didnt really get any where.
That's unfortunate
How long ago was that? The community has grown a lot recently and there's a lot more tutorials and support
I may circle back. It is nice to be working on something.
It has been awhile. I was just looking at it yesterday after you mentioned game engines.
Ah cool
My book will keep me busy. This is all for fun for me. If it gets stressful I can stop whenever I want. I am always drawn back because it helps calm my chaotic/anxious mind. I love the structure of programming.
Oh yeah, you definitely don't need to crowd yourself with too much stuff at once
I will never be more than a student, but I will always look for knowledge.
Im 55 so I dont have time for another career. It is pure recreation.
I graduated high school this may
I have a long way to go
You have a lifetime to go. It will pass in the blink of an eye if you dont stop to look around once in awhile.
Believe me. I know.
It's nice being able to relax
I'm lucky to have parents that pay for my room and board, so long as I'm in school or employed
I have that rule for my children. My son is not is school. He works and pays me 500 a month. My daughter is in her second year of University and doesnt pay. She is only at home when school is on break.
I would rather have my son pay me 500 than a stranger 1000.
I'll take it if you dont want it
😂
I have had a great week programming. Big steps forward on the ole space game. I keep thinking of features to add.
That's great!
So far Processing is handling it pretty good. I dont notice any lag on my screen. That is stuff I dont understand yet. Getting the program to run at maximum efficiency.
I wonder how much I can add. Only one way to find out.
time to add one hundred thousand asteroids!
I want to rework/refactor how they are added.
asteroid_difficulty can be reworked.
I need damage if the enemy hits the ship.
That will probably be next.
I need to be able to just have a collision between an enemy and actors[0] in the ArrayList but not the asteroids. Interesting.
Shouldnt be too hard. ship position and enemy_list element position.
definitely
Lots to pick at for awhile. I gotta get off now Loud_Cat. I am sure we will speak again. It is nice to have a human to discuss this stuff with.