|
Funky player logic. |
julian_boolean
Member #8,201
January 2007
|
It's not much, but I was curious if this looks okay. It's basically for your typical hack and slash type game.
Also, how can I make toggleable buttons? Since I assume that key[KEY_A] (the key to switch attack mode on and off) will need to be toggleable. Right now if you press it, it would probably just turn attack mode on indefinitely. |
aadfo824
Member #7,265
May 2006
|
For toggling, try: //in loop or descision-making function if(key[KEY_A]) player->toggle_attack_mode(); //in toggle attack mode funtion player->attack_mode = !player->attack_mode; However, you should probably set some kind of delay, so it only toggles once every, say 500 ms. I'm not an expert so I won't reccomend where things should go. (I don't know myself) |
piccolo
Member #3,163
January 2003
|
this is a little better.
wow |
julian_boolean
Member #8,201
January 2007
|
aadfo824: cPlayer* player; How would the cPlayer class know what the instance "player" is when it's being declared in a different class? this.toggle_attack_mode() = !this.toggle_attack_mode(); Yes, no? piccolo: By putting player->attack_mode(false) inside "if (player->attack_mode(true))", wouldn't that automatically turn it to false as soon as it becomes true? |
piccolo
Member #3,163
January 2003
|
so your saying that these are just animations and not logic functions? if (key[KEY_W]) wow |
julian_boolean
Member #8,201
January 2007
|
To tell you the truth I have no idea what I'm doing. Here's some different stuff.
|
piccolo
Member #3,163
January 2003
|
ok its a Zelda style game right? so just let those be logic functions let the logic functions toggle a globe variable use the case statement to setup refence to a sprite sheet. then use someingthing to flip the frames each program loop. i have a MMRPG in the depot take a look at it in going to update in right now. may 07 2007. wow |
julian_boolean
Member #8,201
January 2007
|
The whole looping through a sprite sheet (assuming that each sheet would contain the base model of a character's every direction and action, like walking left, attacking left, etc) is what I'm not even remotely sure how to do, especially when trying to incorporate direction into it. |
piccolo
Member #3,163
January 2003
|
ok my game source is updated. before you look at my game to to this site this is the best allegro game site in the world. http://agdn.netfirms.com/main/ witch will put you here http://danielh7.tripod.com/main/ edit: i would love to help keep this site updated. wow |
julian_boolean
Member #8,201
January 2007
|
Thanks a bunch. This seems to be really helpful for the most part: http://agdn.netfirms.com/main/html/zelda.htm What the hell is up with this though? Why not this?
|
piccolo
Member #3,163
January 2003
|
its easyer to read and understand for new programmers example num1 = num1 + num2; num1+=num2; the first one is easer to understand. wow |
julian_boolean
Member #8,201
January 2007
|
Fair enough. Hows this look?!
In my eyes, it looks like a whole lot of if statements.. I mean this would all be inside the main logic function (for in-game anyway) and there's still an assload of more stuff that needs to go into it, but is it fine? |
piccolo
Member #3,163
January 2003
|
its ok for a base i guess wow |
julian_boolean
Member #8,201
January 2007
|
http://agdn.netfirms.com/main/html/zelda.htm Could someone explain this: void Player::draw(BITMAP *bmp) { draw_sprite(buffer,(BITMAP*)data[GUY000+frame].dat,x_pos,y_pos+48); } And this: if (dir==LEFT) { x_pos-=4; if (frame<4 || frame>5) frame=4; if (x_pos<0) { x_pos=(GRID_X-1)*TILESIZE; map.scroll(LEFT); screen_x--; map.getGrid(room,screen_x,screen_y); } Is he using seperate bitmaps from the datafile, or sheets? I want to use sheets. And how is he going through the frames to make the animation? |
Jonny Cook
Member #4,055
November 2003
|
Quote:
player->attack_mode(true); That's a little redundant. The face of a child can say it all, especially the mouth part of the face. |
|