#Invitation to play my game. Thank you if you helped me. You know who you are.

127 messages · Page 1 of 1 (latest)

silver gulch
#

I have been working on a space shooter game for the better part of the year. I finally have a working game. I am inviting anyone who is willing to play the game and give me advice about how I may have approached some things better/differently. I welcome discussion about the topic of organization and related topics.

#

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.

quartz burrow
#

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.

quartz burrow
#

Great job tho!

silver gulch
#

@quartz burrow I noticed that too. I'm am not sure why. LOL

silver gulch
#

I have two bugs. Solving one creates the other.

silver gulch
#

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.

silver gulch
#

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.

quartz burrow
#

This way, it always happens last so nothing can be drawn on top of it

silver gulch
quartz burrow
#

You could also make this method inside the Game class if it's easier. Might feel more organized that way

silver gulch
#

True. It is part of the game I guess. It works perfectly.

quartz burrow
#

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

silver gulch
#

I have been cleaning up the code, adding some color and fonts to the text.

quartz burrow
#

ah thats nice

#

Sorry that I keep pointing these things out. I really am happy for your progress, you did a good job here.

silver gulch
quartz burrow
#

haha yeah, but don't stress too much on making it perfect

silver gulch
#

I was playing with it working on collisions.

quartz burrow
#

oh yeah

silver gulch
#

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.

quartz burrow
#

btw since you extended the PVector class, you dont have to declare x and y

silver gulch
#

I still need a collision between enemy and ship, but Im cleanin it up.

silver gulch
#

I didnt see the harm in leaving it.

quartz burrow
#

fair

silver gulch
#

I wrote it initially without PVector. I have learned a TON working on this project.

quartz burrow
#

I see. You've made a lot of progress

silver gulch
#

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.

quartz burrow
#

Yeah

silver gulch
#
 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;
  }
}

}```

quartz burrow
#

Why does it subtract that second half

silver gulch
#

The biggest difference is the objects are in the same list and mine has two different lists

silver gulch
#

subtracting the length from x and y

quartz burrow
#

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

silver gulch
#

when it is inside the length it is colliding

silver gulch
#

PVector.dist() does most of the work.

quartz burrow
#

So size / 4 seems like half of the radius

silver gulch
quartz burrow
# quartz burrow Why does it subtract that second half

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

silver gulch
#

Interesting way to look at it.

#

It is really which more closely communicates what you want.

quartz burrow
#

exactly

silver gulch
#

I have learned programming is getting alot out of the fewest instructions

quartz burrow
#

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.

silver gulch
#

I am attempting to learn C++ from Programming: Principles and Practice using C++ Bjarne Stroustrup's book. He stresses this very concept.

quartz burrow
#

Ah, I've heard C++ is hard so I've been avoiding it haha

#

It is fast tho

silver gulch
#

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.

quartz burrow
#

Oh definitely. The key concepts definitely transfer across all languages

silver gulch
#

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

quartz burrow
#

Yes! I actually did have Processing in high school, it's great

#

But yeah it helps to visualize things

silver gulch
#

Where are you on this big blue marble? Im in Michigan, USA.

quartz burrow
#

I'm in southern USA

silver gulch
#

Well nice to meet you. Most people dont gab much.

#

You work as a programmer/programming capacity?

quartz burrow
silver gulch
#

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++.

quartz burrow
#

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

silver gulch
#

Arduino is what introduced me to C++.

quartz burrow
#

ohh, neat

silver gulch
#

All the wiring slowed me down. Processing doesnt have any loose wires to deal with.

#

I spent alot of time finding hardware issues.

quartz burrow
#

Arduino is inspired by Processing, which is pretty cool

silver gulch
#

Arduino was the gateway to a much bigger world.

quartz burrow
#

I tihnk processing has hardware support now

silver gulch
#

Arduino has a discord server that is quite active. I ask c++ questions there sometimes. They have all kinds of support.

quartz burrow
#

Awesome!

silver gulch
#

I am in 3 servers. This one, Together C & C++, and Arduino.

quartz burrow
#

A nice trio

silver gulch
#

I only read most of the time.

quartz burrow
#

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...

silver gulch
#

I had Godot for a bit but it was over my head. I didnt really get any where.

quartz burrow
#

That's unfortunate

#

How long ago was that? The community has grown a lot recently and there's a lot more tutorials and support

silver gulch
#

I may circle back. It is nice to be working on something.

silver gulch
quartz burrow
#

Ah cool

silver gulch
quartz burrow
#

Oh yeah, you definitely don't need to crowd yourself with too much stuff at once

silver gulch
#

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.

quartz burrow
#

I graduated high school this may Dan_smile I have a long way to go

silver gulch
#

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.

quartz burrow
#

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

silver gulch
#

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.

quartz burrow
#

😂

silver gulch
#

I have had a great week programming. Big steps forward on the ole space game. I keep thinking of features to add.

quartz burrow
#

That's great!

silver gulch
#

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.

quartz burrow
silver gulch
#

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.

quartz burrow
#

definitely

silver gulch
#

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.