Advertisement

bug invaders

Started by April 13, 2019 12:26 AM
59 comments, last by Tom Sloper 5 years, 10 months ago

continue to flesh out your logic

22 hours ago, phil67rpg said:

 ok nice  pseudocode, what should I do next?

 

continue to flesh out your logic. You're going to have to give me this one.

take what you have so far and add to it the things you want to do. And I'll check it again until we get to a point where it's approved to be coded. 

?

The Tech Lead has spoken. Respect the Tech Lead. You'll go farther...believe it.  

 

giphy.gif

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

nice video

Advertisement

here, I'll give you a little push in the direction I think you want to go


bug { 
      vec2 pos
      bool drawFlag = true 
      bool collisionFlag = false
      int collKillTimer = 0
    }
container bugs[n]


draw ship                 
draw bullet                
move bullet up             

for each bug in bugs
   #
   is bug.drawFlag true
      check collision and set state
         if collision
            bug.drawFlag = false
            bug.collisionFlag = true;
            bug.collisionKillTimer = 1.0
            reset bullet
   #

   if bug.collisionFlag is true  
      draw collision              
   else
      if(bug.drawFlag is true)
         draw bug


function timer
   for each bug in bugs
      if(bug.collisionKillTimer > 0)
         bug.collisionKillTimer -= elapsedTime;
         if(bug.collisionKillTimer <= 0)
            bug.collisionFlag = false
            
            
            

the tools are difficult like this. but usable. Now, what is wrong with this design? Should time be part of the object? Should the object care that there is a collision image, maybe it should only care that it has a representation image and let some other system handle collision drawing...see how this works?

You are the one that has to care what the design looks like. It's looking like you really were not ready for more than one bug. If you can't get this, then I fear again, all is lost and we'll have to back up even further.

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

thanks for the pseudocode, I wish it was in c#, I  will try to convert it to c#

well I have studied the  pseudocode and I am trying to convert it to c#, this may take some time.

please check this link https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/collections

Are you familiar with one of the collection types or do you prefer arrays?

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

Advertisement

I have used lists before but I also like arrays, how does this apply to my game?

Lists. Yes. I see.

It was the only porting issue I thought might hold you back. Okay so you're good for the time being?  

When dealing with multiple objects that are of the (same) type, we can group them into containers or arrays.

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

17 minutes ago, GoliathForge said:

Lists. Yes. I see.

It was the only porting issue I thought might hold you back. Okay so you're good for the time being?  

When dealing with multiple objects that are of the (same) type, we group them into containers.

can  you give me a further explanation about containers and how this  applies to my code

What? Which is it? You've used lists and like arrays or you don't understand containers? I've given a simple structure for our bug object. You want a handful of them on screen. We need to represent and store that somehow of our choosing. C# gives us tools to use for this. What exactly are you having trouble with? :D

We're going to get this thing done even if there is some dragging involved. I probably should go for now. Check you later.

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

This topic is closed to new replies.

Advertisement