LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a really basic alleyway for a beginner

  Hello,I am a student making a project related to games and I picked an alleyway.I've read through a couple of threads on here dealing with making a game of alleyway in LabView.I a still a newbie and I am asking for some guideance inorder to be able to make such a game.I ask you to please have some patience with me.

  I am ,as you figured it out ,EchoWolf's class mate. And I also like also to learn LabView not just coping and cheating for I would like to increase my knowledge in LabView and because the purpose of this assignment is to learn.

 I have seen with EchoWolf's post and I was impressed how I was able to make a ball bounce from different starting positions and different angles.

 

As I want to keep this game basic, I don't think I'll worry about having different ball speeds so far.

Alley way is a game when the ball hits the brick and it breaks(disappears),how can I do it do I need to vanish it using the property node.

I am sorry, I was not taught enough and I only ask for guideance and patience for I am a quick learner and I am very good at Math and Physics and I have some experience in C++ although the syntax stinks.

 

Due to my inexperience, this might thake a lot of time.I thank you for any and all help anyone may be able to provide. Thank you in advanced for your patience.May I never fail you.

 

 

This is what I have found .XD

 

 I am having trouble posting this message.

 

 

“Give a man a fish and he will eat for a day; teach a man to fish and he will eat for a lifetime”

"to learn a lesson is a far better reward than to win a prize early in the GAME"

 

 

0 Kudos
Message 1 of 24
(3,830 Views)

Who is this?  Seriously, when I saw it at first, it looked like one of those "copypasta" messages on a certain site (the name of which cannot be mentioned).  But, as this is a legitimate forum, I am hoping that this is not a troll.

Though if you are indeed my classmate, I can definitely understand the  "I was not taught enough" part.

0 Kudos
Message 2 of 24
(3,806 Views)

LOL,

 

First, let's play nice and actually give the source of the code you attached. I have the gut feeling that it is overly complicated and could be done with 25% of the code.

 

As a first step, I would enable "smooth updates" on the image indicator to prevent the annoying flickering 😉

 


Echo Wolf2 wrote:

As I want to keep this game basic, I don't think I'll worry about having different ball speeds so far.

 


Yes, you have to worry, because the speed e.g. needs to change sign when it hits an object. Of course you could solve it with complex data and keep the speed magnitude constant. 😉


Echo Wolf2 wrote:

Alley way is a game when the ball hits the brick and it breaks(disappears),how can I do it do I need to vanish it using the property node.

 


I don't think you understand the meaning of "property node". What exactly did you have in mind?


Echo Wolf2 wrote:

I am sorry, I was not taught enough and I only ask for guideance and patience for I am a quick learner and I am very good at Math and Physics and I have some experience in C++ although the syntax stinks.


It's probably the wrong approach trying to reverse engineer existing complicated code, so what I would do is start with some simple code like your classmate, writing someting where the ball bounces off walls only. Then you can expand it and add bricks. At the end add a paddle for user control.

 

Make a plan about good data structures. How is the arena represented in memory?


Echo Wolf2 wrote:

Due to my inexperience, this might thake a lot of time.I thank you for any and all help anyone may be able to provide. Thank you in advanced for your patience.May I never fail you.


 

The only way to really gain experience is to write programs. It's been 6+ hours since you posted. How far did you get in the meantime? Show us what you are doing and please ask questions when you get stuck. 🙂

 

We won't write assignments for you, but we are willing to nudge you in the right direction.

0 Kudos
Message 3 of 24
(3,788 Views)

  I am sorry that I was unable to reply instantly,but after the vacation(which was full of studing for exams and midterms) the classes started and I was occupied preparing for my lessons.Moreover,my parents limited my time on the Internet so I only just saw your post twenty minutes ago.

 

As for the code that I posted ,I have downloaded it from NI search(games);where I downloaded all sorts of games;inorder to understand the code and try to figure out what to do.  I have also seen that this alleyway game is not that efficient since moving the paddle takes alot of time.

 

  I haven't seen the (new)post of Echo Wolf ;but I am able to make a ball bounce (but I have noticed that the ball bounces only when the center of the ball hits the wall not the edge)

 

  Can you just tell me how can I link the bricks to the ball;can you give a pointer or a small example.

 What I am thinking is when the coordinateof the ball is almost equal to the coordinate of the brick , the brick vanishes(I am capable to vanish and make objects invisible)but I don't think it is the right way or the simpler way since the brick and the ball are not point objects (they are two dimensional objects) or should I take the "ball" and the brick to be points(not two D) for the simpicity of the game?

 

 

 The things that are posted by altebach in Echo Wolf's thread are new stuff that where not taught to us(we were taugth simple exmples)[with all respect I did not know that it could be done]

 

The thing I(till know) make a ball bounce(although it only bounces when the center hits the wall)

 

I have limited experience with LabView(especially the one concerning the"ball"and the brick,but I am willing to learn how to be able to do them.

I understood how to make a ball bounce but I am still lost with the "brick".

 

  I will place the paddles finally when I figure out the relation between the brick and the ball)

 

I am sorry if I don't reply immediately for my parents are strict and won't let me spend enough time  on the Internet(NI).

Thank you for your patience.XD

 

 

“Give someone a fish and you feed him for a day; 
Teach someone to fish and you feed him for a lifetime.”

 

 

 

 

0 Kudos
Message 4 of 24
(3,746 Views)

Echo Wolf2 wrote:

  I am sorry that I was unable to reply instantly,but after the vacation(which was full of studing for exams and midterms) the classes started and I was occupied preparing for my

 The things that are posted by altebach in Echo Wolf's thread are new stuff that where not taught to us(we were taugth simple exmples)[with all respect I did not know that it could be done]

 

The thing I(till know) make a ball bounce(although it only bounces when the center hits the wall)

 

I have limited experience with LabView(especially the one concerning the"ball"and the brick,but I am willing to learn how to be able to do them.

I understood how to make a ball bounce but I am still lost with the "brick".

 

 

 

 

 


 

Instead of thinking about the edge of the ball hitting the wall, think about a the center of the ball hitting a rectange that is the radius of the ball inside the existing walls.

 

Let's say that your existing walls are a rectangle from 0,0 to 150,200.  And your ball is a diameter of 10 (thus radius of 5).  Detect a collision of the wall whenever the center of the ball equals or goes outside of the recangle from (5,5 to 145,195).

 

When working with bricks, it would be just the opposite.  If you have a brick that is located at let's say 50,50 to 55,75.  Enlarge that rectangle by the radius of the ball to 45,45 to 60,80.  Now when the coordinates of the center of the ball are equal to the boundaries of that new rectangle, or inside of it, then you know you have a collision.

 

 

Message 5 of 24
(3,708 Views)

I have understood the geometry(by changing the dimensions of the rectangle w ca alter where the ball hit)

but how do I draw the brick(is it the same way I draw the ball )[stupid question]{when it detects collision how do I let the bricks break?Do I ned to use the vanish or is there another simpler way}

 

I have understood what you have posted and I will try do it(try to detect collision) but I am still don't know how to break it.

After collision the x and y would be erased but what about the rectangle; don't you have a simple example where I ca understand the concept better[what should I use to let it disapear?]

 

 

Ok,this is what I am thinking for my second choice  :

 

If false the brick will remain in its place and will be like a boundary or a limit

if true the brick or drawing will be removed and no boujndary of limit,

so I must put the drawing inside and check if true or !true

 and to increase the bricks all I need is a for loop where the coordinates of one brick is placed and the coordinates of all the remaining are implimented

But should I check every brick alone?

 

Does the logic behind my second plan work[I know it is not efficient looking at every "brick" and placing limits at every side of the block]

 

Please ,am I heading the right way?With this I do'nt work on the "visible" and not "visible"

 

Thank you again for your patience.

 

Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.

 

 

 

0 Kudos
Message 6 of 24
(3,692 Views)

Theoretically speaking,if I had a couple of alleyways with the samecode and the same positioning of the bricks and the launch of the ball,the running will be the

 

same?

 

Inorder to change the game play , all I need is to change the positioning of the bricks(right?) and I will have a different game each time.

 

Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. 

 

 

0 Kudos
Message 7 of 24
(3,686 Views)

Yes. You'll need to store an array of bricks and their dimensions and compare the ball to each one.  If you order your bricks so that the closest ones to the paddle are listed first, and search until you find the first collision, the search through the array for collisions should run faster.  You could also do some schemes where you find a bounding rectangle of all bricks and don't search for collisions of individual bricks until you detect the ball has entered the bounding rectange.  You could either have a boolean to say whether a brick is still present or not.  Or delete the brick from the array once it has been struck.  How you draw or undraw bricks to make them vanish will all depend on your graphics scheme.

 

Different brick patterns would be one way to change the game.  Also, in the Atari version of breakout, the angle off the paddle varied depending on whether you hit the center of the paddle or the edges.  You could also introduce some small variations on the angle of reflection after a collision that is based on a random number to help vary the game.

0 Kudos
Message 8 of 24
(3,665 Views)

Here's what I would do:

 

Create a simple 2D integer array.

 

e.g.

 

0 0 0 0 0 0 0 0 0

0 0 1 1 2 1 1 0 0

0 0 1 2 2 2 1 0 0

0 0 1 1 2 1 1 0 0

0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0

 

An graph it on in an intensity graph. Now use the "Plot images" overlay to generate the ball and the paddle using picture tools. Do the ball movements as before, but with a max speed of 0.05 for example.

To test for collisions, truncate the current position and index into the 2D array. If the element is != zero, decrement it by one and reflect the ball. You can determine the edge that got hit by looking at the remainder of the truncation.

 

The entire code would probably fit on a few businesscards. 🙂

0 Kudos
Message 9 of 24
(3,650 Views)
I am encountering a situation where the "ball"moves along the segment.
0 Kudos
Message 10 of 24
(3,621 Views)