Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: Attack on the Forest
 Post Posted: August 7th, 2017, 2:35 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2782
Location: Oklahoma, United States
I love urban dictionary, without it I'd be stuck asking about this new newfangled internet speak every few posts from chili et al. I had to look up TL;DR before as well, though I'm guessing it's not new.
Dictionary.com wrote:
First recorded in 2000-05; from its use in digital communications

_________________
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: Attack on the Forest
 Post Posted: August 7th, 2017, 10:34 am 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 170
*gives Chili full credit for the save* I did just recommend you to a friend of mine, though, please forgive me ;-;

I can't say I knew what TL;DR meant until a few weeks ago. I finally figured out what it meant because of the context.

By the way, I think I'm going to log progress here from now on. Just so that I can see what I did in the future.


Last edited by Zedtho on August 7th, 2017, 10:43 am, edited 1 time in total.

Top 
 Profile  
Reply with quote  
 Post subject: Re: Attack on the Forest
 Post Posted: August 7th, 2017, 10:42 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
Haha, just pullin yer noodle mate. Can't wait to get some time to check out what you're doing here :)

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post subject: Re: Attack on the Forest
 Post Posted: August 7th, 2017, 11:01 am 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 170
Will log what I've done in this post, I guess.

Also, I was thinking of buying this book , because I have 33 $ that I get to buy a book with, and I was struggling with how game patterns work (Tile-based systems, basic fighting games, and I dunno I have 33 bucks on amazon why not use it :D). https://www.amazon.com/dp/0990582906
Just checking in here to find out if this book is ok and also asking if I should buy hardcover (for 33 bucks) or kindle version. Just something else I noticed, those customer reviews are shady, all these 5 stars o.O.

Something else, I seem rather scatter-brained. I need more words to express random stuff. (Just look at how many times I use "Also, just, by the way")

For the Changelog!
Pre-Delta (Because I looked up Greek Alphabet in Google)

  • Currently have a "MyVec2" class that I can work on to learn about vectors

  • I've made a User and Entities class that can interact with eachother. (Needs refinement) (Entity or better said Enemy is currently a red square)

  • Added Sprite/Animation Support (Thanks Albinopapa, be sure to check out his post on it)

  • Added some Sprites, still needs everything in the spoiler. Missing Sprites are replaced by white currently. (Not in Albino's version):
  • West-Running animation
  • SouthWest-Running animation
  • NorthWest-Running Animation
    (And the mirrors of these, but that doesn't take long)

  • Added a State Machine (again, thanks Albinopapa for the help)

I shouldn't forget to list what's upcoming either:
  • Add Albino's new stuff to the game.
  • Add the remaining sprites
  • Add Sprites so that I can kill Entities
  • Add the Tower in the middle that is going to be attacked by Entities (Sprites & Class)
  • Change the Entites class to have an Attack Priority (make sprites for them then too)
  • Make different types of Entites (more enum classes? Or am I overdoing this :P)
  • Add the wave-based stuff
    And there's a lot more I can add to this, luckily :D

Quick question here, too:
If I want to have multiple swords for the character (or atleast open the possibility for that) should I have a sword class (with an enum class in it for which type) and have either a separate animation for each sword where the user uses it or one animation for the user that is swinging its hands holding no sword and draw a sword animation ontop of that.


Chili wrote:
Just pullin yer noodle

o.O


Top 
 Profile  
Reply with quote  
 Post subject: Re: Attack on the Forest
 Post Posted: August 7th, 2017, 4:25 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2782
Location: Oklahoma, United States
Zedtho wrote:
If I want to have multiple swords for the character (or atleast open the possibility for that) should I have a sword class (with an enum class in it for which type) and have either a separate animation for each sword where the user uses it or one animation for the user that is swinging its hands holding no sword and draw a sword animation ontop of that.


If the swords are going to behave differently, then have different sword classes through polymorphism, or use the enums if you aren't ready for polymorphism. If the swords are going to behave the same, but have different data, then just create a struct for each sword type, and pass the active type to a function in sword or sword constructor. If it's just different sprites with no behavior change and no value changes, load all the sprites for all the swords, create a current sword sprite pointer, and when the user changes swords, assign the address of one of those preloaded sprites to the current sword pointer.

Make the animations for the character and sword separate. You'll still have to draw the different sword animations, but not the character. The other way, If you have 5 swords, you'd have to draw the 8 directions for the charcter for standing, running and fighting times the 5 different swords, minus the three mirrord versions I supoose.

Just to give you a reference, the sprite class and alphasprite class in my project do practically the same thing and I could have used an enum to determine which PutPixel function to call, but they DO have different behavior for their drawing, so I made them different classes with the common stuff in the parent class.

The AnimationController class has the same behavior and can display either solid or transparent sprites, depending on which type were loaded into the frames object passed in. And in Frames, that's why I made the Frames::SpriteType enum, so I didn't have to make separate alphaframes and solidframes classes, they both would have the exact same behavior.

I'm going to try the same approach for the Particles I've been working on for a couple of days.

NOTE: Before you buy the book, check out the link in my tag, Game Programming Patters. There is an online version you can read through and see for yourself if it's worth buy the hard back version or not. I've looked through it quite a few times over the past year, and have found it informative and it's a nice read. The explanations of how to use the different design patterns is clear, and the examples are nice, it's probably just me, but there's not enough depth for grasp the patterns just by reading it. I'm have to practice the crap out of it to get it to sink in. Not the authors fault, I'm sure most people get it the first few times.

Some patterns are easier to understand; Game Loop and Update are both things you're already doing. The strategy pattern ( or close to it ), is pretty much the style that chili has been using for teaching.

_________________
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: Attack on the Forest
 Post Posted: August 8th, 2017, 8:52 am 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 170
I'll get the book then, it'll come in handy. Thanks for answering my other questions too!


Top 
 Profile  
Reply with quote  
 Post subject: Re: Attack on the Forest
 Post Posted: September 5th, 2017, 3:16 pm 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 170
It's been a while! Nothing new yet, just working on the structure of the code atm. Got a question, though.
I've been trying to figure out how to make a keyboard input switch, something like:
switch(VectorOfAllKeyboardInput) //For statement to loop through all of the currently pressed keys
{
case W:
case A:
//etc....

}

Im mainly here to ask if: 1. Its worth making a switch or I should just use an if tree 2. How to do it if its worth it


Top 
 Profile  
Reply with quote  
 Post subject: Re: Attack on the Forest
 Post Posted: September 6th, 2017, 4:24 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2782
Location: Oklahoma, United States
I think as the framework goes, you have two options worth taking.

1) Use if/else if/else for each key you want to test for
Code:
if( wnd.kbd.KeyIsPressed( 'A' )
else if( wnd.kbd.KeyIsPressed( VK_LEFT )
// and so on for each key

2) Use the Keyboard::Read function to get the current code and state.
Code:
while( !wnd.kbd.KeyIsEmpty() )
{
     const Keyboard::Event e = wnd.kbd.ReadKey();
     switch( e.GetCode() )
     {
          case VK_UP:
          case 'W'
               if( e.IsPress() )
               {
                    hero.MoveUp()
               }
               break;
     }
}

_________________
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: Attack on the Forest
 Post Posted: September 6th, 2017, 9:30 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
You can't switch on the keyboard state because it's not a single integral value. It is essentially a container full of bools.

If you want to run your logic by looking at the current state of keys that are down, use ifs with KeyIsPressed (polling-based input). If you want your game to respond to discrete keyup and keydown events, use a switch with ReadKey() (event-driven input; see papa's example above).

They have their strengths and weaknesses, but generally an event-driven model will give you more flexibility and control.

_________________
Chili


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

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: