ProjectMobi Player Interactions

Today's message is about breaking down your actions into smaller pieces.

I was looking into some old code that I am redoing for a project I picked back up. The me back then and the me now have changed so much that I am redoing the class and instead changing it into classes.

as you can see above my code had a lot going on and very little of it held the same purpose. Something I learned from some of my interaction with attempting to apply for some back end programming jobs at my current place of work was that it was business to break things down into the smallest jobs.

If it does not have the same purpose then its needs its own class

This is what I am currently working on which is to give a class a specific goal. In the "PlayerInteractions" Class I am simply checking to see if I Clicked, Dragged, or Held the mouse button. I then set a enum state to keep this record. The purpose of this class was to determine if I performed one of the following actions. Which I then passed into a class called "WorldIntercation."

Click, Dragged, Hold
No alt text provided for this image

The big change in this approach is that when something breaks you have a detailed list of classes to hunt through and the options within that class should not be overwhelming.

No alt text provided for this image

It becomes a bit more work in the beginning with choosing how far to break things down but in the end you have a project that is both easy to work with and if you throw someone else in the mix they do not have to stare are your headache of mess of code.

They can take a smaller Bite.
0.O

I still have a long ways to go till I have a finished game. I look forward to more moments of thought.

HeadachewithPictures


要查看或添加评论,请登录

Joshua W. Belangia的更多文章

  • ProjectMobi - Branching

    ProjectMobi - Branching

    To anyone who has followed my post in the past few months, things were flying at a pace that I thought the game would…

  • ProjectMobi AI – Two Discussions

    ProjectMobi AI – Two Discussions

    ProjectMobi - Blog Hello, Today I want to discuss what paths I am thinking about while making the AI for ProjectMobi…

  • Indy Progression

    Indy Progression

    Indy Progression ProjectMobi is underway, we are excited to move forward even if its just a little bit each day. This…

  • Spine Animation & Unity2d

    Spine Animation & Unity2d

    Hello hello, This is a follow up from my last post about using "Spine" to animate sprites. I wanted to show an example…

  • Game IDEA - The Approach

    Game IDEA - The Approach

    NoNameGaming Blog Below is a re-iteration of my blog Game ideas are in the masses. I can see after searching Unities…

  • React - Resume

    React - Resume

    So what if my resume is in the language they code in? Does that speak in volumes or data, render me this?

社区洞察

其他会员也浏览了