A follow up video explaining this a bit more would definitely be nice, especially explain the for loop. :)
@jinxpc11 жыл бұрын
I cant believe someone Disliked this video, best java Series ever!!!!
@LachezarTsv5 жыл бұрын
Although it gets kinda confusing, I understand the whole thing, for which I am thankfull, because this really helps me for my project and I believe it will keep helping me in the future
@stonegolemstudios9 жыл бұрын
god i spent the last 30 minutes trying to find why boolean for in physics class could not be set to an integer... ohh its because i forgot a tiny very significant i for my entb... anyways keep up the work bud, your tutorials will shape my future programming.
@iq05782 жыл бұрын
How can you change what entity is on top?
@saulivanflorestorrescoto95808 жыл бұрын
You make the best tutorial bud, keep it up, and thank you. You really made me understand the concepts!
@JavaCoderz10 жыл бұрын
Why am I getting a null pointer exception and my game is freeing when I shoot a bullet? I checked my if(Physics.Collision(this, game.eb)) and it is right? I checked the Collision variable, and it is returning false when I don't shoot, but when I do shoot, I think it is returning null. How do I fix this?
@ferasali82283 жыл бұрын
i think its too late now,but i had the same issue and i literally scanned my code for anything related to collisions and the physics thing,i went to my enemy class and i found a getBounds function that returned the value to null,removed it and its working perfectly fine now
@Robinno1211 жыл бұрын
follow up video would be nice :D thanks for doing this series, great work, keep it up
@yPhil10 жыл бұрын
Better and better... Your mind is a very nice place :)
@m.husainmns33667 жыл бұрын
a follow up video plz and thank's alot we're learning so much
@AsdFG5XQW9 жыл бұрын
I was wondering if you could use the Cross Product as collision detection? it will check if it intersects by returning 0
@ajkdrag8 жыл бұрын
You are passing the game object as the parameter into the bullet class by ( public Bullet( double x, double y, Textures tex, Game game )) . This basically allows the bullet class to have access to the variables and methods of the game class.. Isn't this a bad practice? help needed. I thought the whole point of creating the textures class was so that the bullet, enemy, player would interact with the Textures class for getting the image sprites, and hence the game class would not be accessible to the bullet/enemy/player etc... please clarify. Can't we have another class to do the collision detection thing. or couldn't this be done in a different way?
@valentin27629 жыл бұрын
How would I detect collision between the Bullet and an enemy ship which results in a: c.removeEntity() of the bullet that collides and the ship that is hit? Moreover, how do I correctly utilise the c.removeEntity() method to remove specific objects such as the bullet and the enemy ship that collide?
@kiryonnakira75665 жыл бұрын
why public x and y when u can make them protected? also why in that caseu let the getters and setters if variables are public ?
@fatihcenesiz95875 жыл бұрын
What we need to do when bullet is too fast, its skips enemy and collision is fails ? Please answer
@kosac44147 жыл бұрын
did he make a follow up video explaining about collision cause it was difficult to understand it?
@Stat1onary4 жыл бұрын
Is it possible to get a paste of the code to explore?
@lapnghiepshopee6 жыл бұрын
why dont you use AABB or SAT algorithm ??
@yPhil10 жыл бұрын
How can I do this integration / load / create / completion / analysis magic in Emacs? (I just have completion and class links)
@ajkdrag8 жыл бұрын
Also you have no method to remove the bullets once they get off screen.... To do that.. we can go to the tick method in the controller class... and add if(entityA.getY() < 0){ removeEntityA(entityA); }
@ejbytes8 жыл бұрын
Very cool. I've never used collision detection in Java. I was going to create another game in Flash, but saw this. I haven't been in programming mode in a while... I have a question. Thinking aloud, so bare with me. At 16min, I was thinking about your method of Collision(A, LinkedList B) using a for loop on B (enemies). I wonder if you could instantiate Collision detection in each Entity B as a trait/property of B? What I'm getting at is this. You probably have to put Physics in a ticker yeah? So each ms you have to ask, "is A colliding into loop(all B)". Am I okay still? But if you added a Collition trait and ticker to each object as it's instantiated you wouldn't have to tick a loop of objects, but semi-simultaneously tick each object dynamically as they are created because you'd have added Collision to each object upon instantiation. Would that work? Thinking aloud...
@ejbytes8 жыл бұрын
***** My comment was on the inefficiency of using an array and looping through ALL the objects existing. If you listen to his explanation and re-read what I'm stating, you will see that my point was to make the deletion of objects more efficient by usage of dynamically allocation on each object rather than tracking objects in an array; because a loop in constant N of Big(O). Whereas my suggestion is 1:1 on a scale of Big O(1).
@space-nu6hc8 жыл бұрын
in the collision class the parameters take entityA and a linkedList why is one a linked list and one isn't
@space-nu6hc8 жыл бұрын
Don't worry, i'm waaaay past this. I learned to do a lot more advanced things. A lot of things involving math, geometry, and even calculus. And that's great because i'm starting at such a young age. So i'm very proud of myself.
@srinicnu52833 жыл бұрын
xception in thread "Thread-0" java.lang.NullPointerException: Cannot read field "eb" because "this.game" is null how to fix it!!
@srinicnu52833 жыл бұрын
got it fixed without your reply sir
@RealTutsGML11 жыл бұрын
Thanks! I am glad you like my tutorials. I will be sure to contact you if I ever need anything! Thanks again.
@gameriffy24588 жыл бұрын
when i'm shooting, the console said COLLISION DETECTED a LOT of time, and stop when the bullet get out of the screen, help me
@TGamingFull9 жыл бұрын
My player starts at x = 0 and y = 0 and the bullet doesn't come out from the player. I have removed all the x, y in player and bullet class. Please somebody help!
@ejbytes8 жыл бұрын
Reading comments... I don't think this is a Q&A. so maybe my question below would be asked to an onlooker instead?
@truthseeker117 жыл бұрын
I wish I could see this code as a whole. It's so hard to keep track going back and forth and seeing only a portion of the IDE.
@ratsec17564 жыл бұрын
hehe ide internal dick eruption
@Tokw1111 жыл бұрын
I freeze when i shoot due to Exception in thread "Thread-2" java.lang.NullPointerException at game.src.main.Physics.Collision(Physics.java:14) at game.src.main.Ball.tick(Ball.java:29) at game.src.main.Controller.tick(Controller.java:50) at game.src.main.Game.tick(Game.java:162) at game.src.main.Game.run(Game.java:136) at java.lang.Thread.run(Unknown Source) can anyone help?
@ricesoup511510 жыл бұрын
I just freeze when I shoot the bullet, It say NullPointerException at if(enta.getBounds().intersects(entb.get(i).getBounds())); Pls help
@xxGrandaSxx10 жыл бұрын
I hope you fixed this already, but for others if they will have that kind of problem, at least I had at the line, in Bullet.java where in method tick() I forgot to change if(Physics.Collision(this, null)) to if(Physics.Collision(this, game.eb))
@quantumcookie648 жыл бұрын
Or could we create EntityA and EntityB , both extending Entity ( both ARE entities, right ? ). That might make the code any simpler ?
@sreeramoffcl8 жыл бұрын
+Sethu Kumar Its me sreeram ive got where you r learning to design games It can be more simple create an abstract class instead of interface create an enum for id thats it
@konev13thebeast10 жыл бұрын
I just had my EntityA and EntityB extend Entity
@ctheart88338 жыл бұрын
hello , is there any other way to detect collision , other than rectangle , if the two sprites are circle then this method reports collision even if the circle comes close to each other without touching ?
@quantumcookie648 жыл бұрын
+C The Art If the distance between the centers of the circles is less than ( or equal to ) the sum of their radii , then the circles collide.
@ctheart88338 жыл бұрын
thanks ,will try
@kamalahmad45668 жыл бұрын
hi Zack I knew this old video and you star other series but I need your help in collision So i add die() method which remove enemy at first it works but when I add more enemies it don't remove enemy that get shot but remove other enemy I know why this happens because we used Linked list when I use remove () it remove frist enemy that added in linked list So how l can remove spceific enemy that get shot So plz I need your help to Finnish my game
@Tokw1111 жыл бұрын
Okay and also in the bullet class it says game is not being used but im using constructors such as game.eb .
@bugfacedog4411 жыл бұрын
Is it possible to just have a boolean value for every entity instead of making two seperate kinds? true = A false = B
@physicsimpossible7310 жыл бұрын
What about if you had Entity as the superclass and the Entity A and Entity B extend that and then all the objects extend from either Entity A and Entity B? Would that be OK? I haven't done it, just wondering..
@WaseemSwaileh10 жыл бұрын
Epicnerd73 I am was going to say the same thing ... Actually I have do it .. at run-time the compiler knows exactly what to do .. !!
@physicsimpossible7310 жыл бұрын
Waseem Swaileh So it works then?
@WaseemSwaileh10 жыл бұрын
Epicnerd73 it works till I implement Collision ... We need two methods one for get EntityA and EntityB .. and I spend 2 hours trying to figure that out .. but with no luck ... I think we Should encapsulate it with another class and do so check to know the LinkedList to which interface it belongs ... No Idea how .. I know Just that .. We should encapsulate what varies ...
@physicsimpossible7310 жыл бұрын
Waseem Swaileh hmm.. Ok, maybe just scrap that idea then.. lol
@WaseemSwaileh10 жыл бұрын
Epicnerd73 Working on it lol ..
@diggerplus45299 жыл бұрын
so... my ship starts in the top left corner now and the bullets, when fired, stay up there even if the ship is moving around... did i miss something? watched the video 3 times and my code looks the same as far as i can tell.
@DanFletcher909 жыл бұрын
you have to delete "private double x, y;" at the top of your classes. you no longer need them since now you should have: "super(x, y); " inside of your constructor
@diggerplus45299 жыл бұрын
Dan Fletcher thanks. it's typical for me to miss the simplest things. appreciate the help. all is good now.
@DanFletcher909 жыл бұрын
no problem, I had the same issue. that's how I knew how to fix it :)
@TGamingFull9 жыл бұрын
Dan Fletcher I have the same issue to but I have deleted all the x and y. Please help me
@XceriasNationPyah10 жыл бұрын
I'm 3:44 into the tutorial and when i shoot it the bullets appear for a second at the top left..
@chromdusw642810 жыл бұрын
Make sure that you remove the private double x, y at the top of the class
@nashbone4728 жыл бұрын
I went through the whole video and every code is written exactly the same, but whenever I ran the game, nothing will load up, bullets, enemies won't show up but the player works. Why is that? Someone please help. Thank you.
@brandonfalconer20908 жыл бұрын
+DeepVenganceTV Are you getting an error in your console?
@daneczech11 жыл бұрын
can I download the project somewhere please?
@RealTutsGML11 жыл бұрын
Yeah, go to the swing forums and check that out. That helped me out sooo much. Good luck!
@hardayasingh265411 жыл бұрын
yup got it...Thankx man... really appreciate your work :D
@bartolj.45029 жыл бұрын
when i run the game at 16:44 my enemys dont move, but i can shoot bullets and move player, and few seconds later my enemys start to move and then error occures :( pls somepne help
@darkpaladin.8 жыл бұрын
+Bartol J. Try checking your tick method in the controller
@bartolj.45028 жыл бұрын
Hi, thanks man for trying to help me but this post is like 10 months old and i dont have the code anymore
@darkpaladin.8 жыл бұрын
I could send you the code if you're interesting
@bartolj.45028 жыл бұрын
nah i switched from java to web development just until i get new laptop
@darkpaladin.8 жыл бұрын
Ok bro, Peace.
@michael_zhou11 жыл бұрын
when I shoot, it displays "collision detected" infinity in the console until I close it. There were no errors displayed, and I watched this video 3 times. I don't know what's wrong. Can anyone help me?
@SteveMorrow88599 жыл бұрын
Nice stuff. Do you still do game development anymore? I've been following a guy called Indie Developer on another channel. This has led to a reenacted game I created in the 90s. It's a platformer, modeled after the original Pitfall 2 Atari series. Do you know anything about Java sound by the way? Seems to be a complex topic. Thanks.
@RealTutsGML11 жыл бұрын
Keep watching the series :)
@dje64294 жыл бұрын
Hi, awesome tuto, but why do create 2 double attributes in GameObject class to convert them in int inside getBounds() method ? Why not int directly ?
@jay131m10 жыл бұрын
you explained very well :)
@hardayasingh265411 жыл бұрын
could u please make main menu for this game?
@aleksandarpetrovic10611 жыл бұрын
YOU ARE THE BEST !
@neuro554711 жыл бұрын
"We have the inner sex method."
@spillthecode99179 жыл бұрын
Yeah, that made me laugh
@BoltReel10 жыл бұрын
Well I just wrote a big comment but hit my back button on my mouse :( Basically I just said you could change: for(int i = 0; i < entb.size(); i++) into for(EntityB variableName : entityBArrayList) to further simplify things. I don't know, it's build into Java so just incase you haven't seen it.
@MrJamyvideo10 жыл бұрын
yep , good idea thanks man.
@BoltReel10 жыл бұрын
allows Some situations it's not the best. But generally its easier to iterate over an ArrayList as a whole like such.
@MrJamyvideo10 жыл бұрын
what situations?
@BoltReel10 жыл бұрын
allows You'll know when to use either for loop. Using the mentioned for list, you dont have a pointer variable, while using the basic for loop however, you do. -- for(int i=0;i
@MrJamyvideo10 жыл бұрын
right yes ahah I also thought about that
@XhubiuXRock10 жыл бұрын
Thansk a lot for videos dude!! I'm making my first game and it's running just great I have a question: where the render in Controller comes from? public void render(Graphics g){ for(int i=0;i
@Brax19829 жыл бұрын
VK_Box But there are render methods in the classes that implement the interface EntityA, that is Player and Bullet. At runtime the compiler determines that it's either of those classes. So it's both a Player and an Entity A, thanks to interfaces creating multiple subtype relationship (there is no multiple *inheritance* in Java).
@McUpdated11 жыл бұрын
Please do a checkpoint tutorial :D
@zedzedy594111 жыл бұрын
hey, how to remove enemy when i hit him with the bullet?
@puqo38095 жыл бұрын
lmao call the remove method maybe? jeez sometimes its better to use your own brain
@adamkubala982711 жыл бұрын
Make GM contest plz....
@RealTutsGML11 жыл бұрын
I am going to do one, I am in the process of making a game for a client and when I am done with that I will use there art to make the series. (The game I am making is a fighting game)
@CPIHOrRbI311 жыл бұрын
I'm stupid. how to remove the bullet, along with the enemy? I can just remove enemy. I changed code in Physics to: if(enta.getBounds().intersects(entb.get(i).getBounds())){ entb.remove(i); Game.enemy_killed++; return true; }
@Brax19829 жыл бұрын
Noooo, the damn Game parameter is back! Well, off the top of my head I have no idea how to avoid it. And why do you write "Collision" instead of "collision"? Capitalized method names...gah. It's probably like that "block" parameter. Something you got used to doing for some reason. If you still remember why, I would love to know where that habit is from.
@iliasilisparrow11 жыл бұрын
Thanks man !
@srinicnu52833 жыл бұрын
what is your age
@RealTutsGML11 жыл бұрын
will get into that when I reach collision detection with the player to enemy and bullet to enemy.
@AnimePFP11 жыл бұрын
Please do an advanced fighter game tutorial for game maker? You never even respond to any of my comments.
@taylorkohls52689 жыл бұрын
So now the game freezes whenever I shoot
@3rdlastsurvivor8 жыл бұрын
+Taylor Kohls did you find a fix to this?
@3rdlastsurvivor8 жыл бұрын
+Taylor Kohls did you find a fix to this?
@balajia39707 жыл бұрын
Awesome!
@matthewnotreal11189 жыл бұрын
Hmm. This doesnt work. It always returns true.
@shatley12311 жыл бұрын
Java tutorials > gamemaker tutorials
@CPIHOrRbI311 жыл бұрын
I already did :). if anyone need. I add new method, similar like Collision method: In Physics: public static boolean Collisions(LinkedList EntityA enta, LinkedList EntityB entb){ for(int i = 0; i< entb.size(); i++){ for(int k = 0; k< enta.size(); k++){ if(enta.get(k).getBounds().intersects(entb.get(i).getBounds())){ enta.remove(k); entb.remove(i); return true; }}}return false;} // In Bullet similar but: private Game game; if(Physics.Collisions(game.ea, game.eb))... Translated by Google :)
@kcreview49374 жыл бұрын
not very clean code, smelly, and not scaleable. Low cohesion and hard to maintain. Just about impossible to add new features as well once the project gets to a certain size
@rmdir4 жыл бұрын
Somethings rotten in Denmark with this game....
@hex11015 жыл бұрын
yay collison detected (mine just says boom)
@speedkung99257 жыл бұрын
AWWWW GameObject is weirdddd!!!! It not render in right place ._.
@speedkung99257 жыл бұрын
Oh.. yeah... finally I fixed it thank you for helpb :)
@betterthansteve56413 жыл бұрын
What was the solution ?
@speedkung99253 жыл бұрын
@@betterthansteve5641 If you asked me 4 years earlier i could probably tell you
@ratsec17564 жыл бұрын
YAYAYAYAYAY
@zbigniew4635 жыл бұрын
You have no idea how it works. You just try to work something without resting. Learn how to do it first bottom-up, then first top-buttom. That what you present is good for someone who know nothing about programming