Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
 Post subject: Re: C++ Progress ish
 Post Posted: July 19th, 2017, 3:01 pm 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3300
Location: Japan
Glad you posted this, it was something I was meaning to look at after things settled down fromthe move. Hotline looks tight. Implementing the line-of-sight stuff is impressive. What the heck are those images you posted? Look cool as fuck.

You're watching all the spoiler from the old series. Bad Ceo! Bad! XD

Good on you again for taking the initiative and coming up with your own sprite rasterization effects. If you like that shit, you're gonna live pixel shaders.

Nice job on the I6 homework as well. How did you like this style of homework challenge?

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: July 20th, 2017, 3:18 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 34
To see if the tracking works properly I put this in the drawing function for enemies:
Spoiler:
Code:
for (int i = 0; i < indexTrackingPoints; i++)
{
   gfx.DrawCircle(trackingPoints[i], 5.0f, Colors::Magenta);
   if (i < indexTrackingPoints - 1)
   {
      gfx.DrawLine(trackingPoints[i], trackingPoints[i+1], Colors::White);
   }
}
And if the enemies have the right amount of delay between them the tracking points spawn very nicely one after another and it forms some dna-looking stuff.

I really enjoy every homework so I don't know what to say. This time was nice that it had tests already implemented and that memory leak detection thing so you know if you fucked something up.


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: August 2nd, 2017, 2:14 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 34
original game

github link

exe
Spoiler:
Attachment:
zigzag.rar [8.94 MiB]
Downloaded 3 times


extract this into the zigzag folder ( because of the 10MiB per attachment thing )
Attachment:
menuMusic.rar [3.66 MiB]
Downloaded 3 times


screenshots
Spoiler:
Image
Image


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: August 2nd, 2017, 4:23 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2662
Location: Oklahoma, United States
Code looks super slick. My son loves the dancing lines game ( just like zig-zag ). Are you going to be adding more levels and music?

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: August 4th, 2017, 6:56 pm 
User avatar

Joined: June 9th, 2017, 11:30 pm
Posts: 18
How Did You Get The Tank Rotation?


Top 
 Profile  
Reply with quote  
 Post subject: Re: C++ Progress ish
 Post Posted: August 5th, 2017, 10:53 am 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 34
albinopapa wrote:
Code looks super slick. My son loves the dancing lines game ( just like zig-zag ). Are you going to be adding more levels and music?

Just watched 20 minutes of Dancing Line gameplay...such a lovely game.
I think I'm gonna leave zigzag as it is for now. Maybe, in the future, I'll make it so the path fits any song automatically, so you can play with any song you want.


goldengamesTM wrote:
How Did You Get The Tank Rotation?

Converting Vec2 to a float angle, doing things to that float, and converting back.
You can find the functions here at line 132 and 177.
or here
Spoiler:
Code:
void Enemy::RotateToward(float wantedAngle, float dt)
{
   if (int((wantedAngle - angle) + 360) % 360 > 180)
   {
      angle -= rotationSpeed * dt;
   }
   else
   {
      angle += rotationSpeed * dt;
   }
   NormalizeAngle(angle);
   enemy.SetDir(AngleToVec2(angle));
}



Code:
Vec2 Enemy::AngleToVec2(float angle)
{
   const float cos = std::cos(angle * pi / 180.0f);
   const float sin = std::sin(angle * pi / 180.0f);
   return Vec2(cos, -sin);
}



Code:
float Enemy::Vec2ToAngle(Vec2 vec)
{
   vec.Normalize();
   float angle = -asin(vec.y) * 180.0f / pi;

   if (vec.x > 0) return angle;
   else return 180.0f - angle;
}



for the tanks game is simpler because there is no AI
Code:

   if (kbd.KeyIsPressed(left))
   {
      angle += rotationSpeed * dt;
      dir = AngleToVec2(angle);
   }
   else if (kbd.KeyIsPressed(right))
   {
      angle -= rotationSpeed * dt;
      dir = AngleToVec2(angle);
   }


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron