Ask Experts Questions for FREE Help !
Ask
    vitaliA's Avatar
    vitaliA Posts: 2, Reputation: 1
    New Member
     
    #1

    May 7, 2017, 09:41 AM
    Java breakout game, multiple hits per brick ?
    Hello


    I am trying to make a program as part of my assignment, a breakout game.
    There are plenty of tutorials for this game.
    However, the challenge we've been given is that one row need to have the bricks that take 3 hits before they are destroyed, the other row 2 hits per brick and last row 1 hit per brick.
    I was trying to figure out different ways to do it, though in the end I though to figure out how to identify each brick by its coordinates in order to be able to manipulate it further is the best way. Though I am not sure it is the best approach for this problem.
    Unfortunately, there is not much information about multiple hits per brick for this game out there.
    If someone can guide me or help me to figure out how to solve this problem I will be very grateful.

    What I was recommended to do is to have a hit counter property in the brick class which I used to create bricks individually.


    I have a method that calculates the intersection of a ball and a brick (by using Rectangle intersects). At the moment that method is called in a loop without anything else.
    Here I am having trouble of grabbing a brick from the array, pass it to the brick collision method and to reduce the number of hits of that particular brick.


    As I have a for loop that goes up to the length of my array, it checks one value after another. But what I need to figure out is, instead of having a loop that increments one by one, how to do it another way where I can identify what brick has been hit in the array and to reduce the number of hits in the property of that instance.

    Regards
    Vitali
    joypulv's Avatar
    joypulv Posts: 21,591, Reputation: 2941
    current pert
     
    #2

    May 7, 2017, 10:36 AM
    This sent me back to about 1977, the first time I played any game on a computer that was not a terminal. It was a Mac and it was breakout.

    Doesn't Java allow you assign each hit to a storage place set aside for each id, and have IF statements at each location, that return null or delete when the condition for that row is met?
    I'm thinking in Excel macros, sorry. I really don't have a clue.
    vitaliA's Avatar
    vitaliA Posts: 2, Reputation: 1
    New Member
     
    #3

    May 7, 2017, 10:58 AM
    I am not even sure what you mean. We have been studying Java for only a year and we've been given this assignment without thorough knowledge. Basically I have to learn it almost from scratch apart of the basics, thus I am really confused with all of this and in particular with my problem in the game. It took me days to figure out how everything works and to find best solution while I was trying to build it. Though I am far from understanding everything about the logic here :(
    joypulv's Avatar
    joypulv Posts: 21,591, Reputation: 2941
    current pert
     
    #4

    May 7, 2017, 12:10 PM
    Google 'java help boards.'

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Java interface with multiple implementation classes having same signature [ 0 Answers ]

My question is regarding java and spring. I have a controller class, service classes and DAO classes. For both my controller and service layers I have an interface and its implementations. Suppose I have one interface in my DAO layer which has two implementations and I call my DAO functions from my...

MouseListeners on multiple shapes (java) [ 0 Answers ]

So I am quite new to java and I want to implement a mouseListener on 4 rectangles that have a randomly generated width and height so that when you click on each one a different dialogue box appears. I don't really know where to start so any help would be amazing!

I am new to java GUI and multiple classes, I have knowledge of core java. I have [ 0 Answers ]

Sir, I am new to java GUI and multiple classes, I have knowledge of core java. I have to call a rest client from my net beans project give values to it and receive it's output in the same project. Please suggest me what I need to study and what to do.

My Java is installed but last night every game I tried to play on club Pogo ask me to [ 1 Answers ]

I have favorite game like crossword cove,penchle,spades world class card game and a few more last night all the mentioned above had a pop to download Java I do not know what to do to fix it

Do I need multiple Java updates? [ 3 Answers ]

I'm trying to clear some stuff off my computer to make more room. I came across these two installed programs: 1. J2SE Runtime Environment 5.0 Update 10 2. J2SE Runtime Environment 5.0 Update 2 My question is would update 10 superseed or include any previous updates or does it stand alone...


View more questions Search