[UPDATE 3.5]Angry Square

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
thetoddfather
Posts: 338
Joined: October 1st, 2012, 9:53 pm
Location: Canada

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by thetoddfather » December 13th, 2012, 10:52 pm

And lastly, just keep in mind that with this the way it is, you may wish to change it to just

Code: Select all

if(r == 255)
col = false;
if(r == 0)
col = true;
and be sure your mod of r is always a multiple of 255 for it to work properly, otherwise it will spin off into oblivion and appear to be working when in fact your col is never changing.

this will allow you to confirm your function is doing its job :)

Code: Select all

char buffer[64];
sprintf(buffer,"col %d r: %d",col ,r );
gfx.DrawString(buffer,100,20,&fixedSys,D3DCOLOR_XRGB (255,0,0));

User avatar
thetoddfather
Posts: 338
Joined: October 1st, 2012, 9:53 pm
Location: Canada

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by thetoddfather » December 13th, 2012, 11:05 pm

And if you want to not worry about their values at all, just make the r,g,b variables unsigned chars (Which have a convenient range of 0-255) and just let them loop freely. Sky's the limit really.

HippoSocks
Posts: 48
Joined: December 10th, 2012, 5:12 pm

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by HippoSocks » December 14th, 2012, 3:33 pm

I considered using defines, but I could break it again..
And what's the point of fixing something that isn't broken? :lol:

I might use defines for the way I set up the changing colour's for the god mode text once the player has the apple, it appears I've also broken some other stuff, so I can't test is that easily, without rewriting the how perks work..

Ahh got to love simple little problems that confuse you for hours right? :lol:
-Socks

User avatar
thetoddfather
Posts: 338
Joined: October 1st, 2012, 9:53 pm
Location: Canada

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by thetoddfather » December 14th, 2012, 4:47 pm

Exactly why it's best not to go into feature overload just yet. Take one problem and follow it through to where you're happy. Then move on to the next until you have a nice streamlined program Then layer on top of that. Some lessons are learned the hard way, and in my case I lost many early projects by diving too heavy into my ultimate goal for the project and getting lost in the mess of mistakes all over the place that I didn't know where to even begin to fix, so I lost interest in the project all together.

HippoSocks
Posts: 48
Joined: December 10th, 2012, 5:12 pm

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by HippoSocks » December 14th, 2012, 4:58 pm

Yea, I've realised that now, the game is that badly caked in a mess of code, I can't find parts im looking for to fix the bugs in the game, some of them being that god mode starts as true, but its ment to be false, and it gets set at run time as false..
Whilst adding that I was rummaging code to find bugs and got distracted from the important part..

Meaning I can only believe that I screwed up a if statement some place, and cant rewrite it without changing a lot of code, or rewriting most of it, all for practically nothing. :roll:

Oh well, mistakes are made.. :lol:
-Socks

ickobombata
Posts: 1
Joined: December 14th, 2012, 8:52 pm

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by ickobombata » December 14th, 2012, 9:20 pm

how can i make new keyboard commands Like to use another buttons from my keyboard thanks!

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by Musi » December 14th, 2012, 9:50 pm

ickobombata wrote:how can i make new keyboard commands Like to use another buttons from my keyboard thanks!
Do you know how the program handles messages yet? You'll need to understand that to add more key's. Chili explains it in intermediate Lesson 5 i think.
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

HippoSocks
Posts: 48
Joined: December 10th, 2012, 5:12 pm

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by HippoSocks » December 14th, 2012, 10:44 pm

I have followed the tutorial where he goes through changing the keyboard, I believe it is about Lesson 5 or 6..

After i finished the tutorial and had the "IsKeyPressed( unsigned char keycode )" I researched ANCII and looked that the VK codes and worked out i would have to set it up using the following codes instead of VK codes..

Code: Select all

0x57 - W
0x41 - A
0x53 - S
0x44 - D
Hope that explain's that a little bit, I can't really explain it to well..

This is the code I used for player movement as an example of how I done it:

Code: Select all

if(kbd.KeyIsPressed( 0x57 )) 
{ 
    PlayerVelocityY = -3; 
} 
else if(kbd.KeyIsPressed( 0x53 )) 
{
    PlayerVelocityY = 3; 
} 
else 
{ 
    PlayerVelocityY = 0;
 }

if(kbd.KeyIsPressed( 0x41 ))
{ 
    PlayerVelocityX = -3; 
} 
else if(kbd.KeyIsPressed( 0x44 )) 
{ 
    PlayerVelocityX = 3; 
}
else 
{ 
PlayerVelocityX = 0; 
} 
To get more of the key codes there is a chart located on the site here:
http://en.wikipedia.org/wiki/ASCII#ASCI ... characters
You will be after the numbers in the Hex column and just put '0x' in front of it.
-Socks

Zionich
Posts: 24
Joined: December 11th, 2012, 12:57 am

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by Zionich » December 14th, 2012, 11:01 pm

I like your game Hippo. The eyes moving in the direction of movement sounds like it would add more flare to the game. It amazing how all those little things come together. Im excited to learn some more of those techniques you have impleminted. All in good time.

for the eyes try

Code: Select all


//in the movement update



if(kbd.WisPressed())
    {
           faceY --;
           eyesY = orginY - 5; //orginY being the middle of the eyeball
     }
if(kbd.DisPressed())
    {
           faceX ++;
           eyesX = orginX + 5;
    }

........................................

if(!kbd.WisPressed() && !kbd.SisPressed()) 
    {
          eyesY = orginY;
     }

if(!kbd.AisPressed() && !kbd.DisPressed())
     {
            eyesX = orginX;
      }

HippoSocks
Posts: 48
Joined: December 10th, 2012, 5:12 pm

Re: [UPDATE]Angry Square, Everything i've learn't in one gam

Post by HippoSocks » December 14th, 2012, 11:06 pm

Thanks for the tips for the eyes there, but I'm not going to work on that just yet, I will focus on fixing bugs first, just like you dont put the icing on top of your cake before you've baked it..

Just because the outcome will end up better. Unless it explodes... :lol:
-Socks

Post Reply