RPG Progress #2

Posted by Harrk on May 15, 2012, 5:18 p.m.

Today I've been working on the interface for the battle room. The actual mechanics aren't fully programmed yet but I'm getting it done slowly.

I really need to start working on this more often as I'm taking advantage of the "plenty of time" until the compo ends.

Here's what I've got with the battle room. I'm not done with the battle sprites for the players yet and it remains undecided if I'll animate attacks or not. I probably won't though.

Sadly - those enemies have more animations in them than the players do. Even if they do just "bob" up and down. Players are just entirely static right now - apart from a flashing effect on the currently selected character indicating its turn.

My new textbox engine :3 (Fire Emblem style):

I hope the half-character portraits don't seem a little off though. I'm not used to drawing anything beyond a head. lol.

There's only one tileset done so far, judged by what I've included in the screenshots. Even then, it's far from complete.

If anyone has ideas for some hazards in the overworld then throw them at me, aside from fire (which is already included) of course :3

As a plus, here's a script that I've made to reuse a simple sprite for any sized window frame. Which I use in my game for all my frames, such as the textbox above and the battle interface.

Just make a sprite of 32x32 (for example) and separate it into 4 subsections, each being 16x16 (one for each corner).

Example: //drawFrame(sprite,tile width,tile height,frame width,frame height,x ,y)

drawFrame(sprFrame,16,16,250,100,x,y);

Demo Link: http://dl.dropbox.com/u/23931032/Game%20Maker/Scripts/FrameBase.gm81

/*===============================/
Author: Harrk

YOU ARE FREE TO USE THIS CODE IN
YOUR OWN GAMES, INCLUDING COMMERICIAL
GAMES.
HOWEVER YOU MAY NOT CLAIM MY CODE
AS YOUR OWN OR REPRODUCE IT AS SUCH.

CREDIT IS NOT REQUIRED BUT IS
ACCEPTED WITH OPEN ARMS ;)

<a rel="nofollow" href="http://harrk.blogspot.co.uk/">http://harrk.blogspot.co.uk/</a>
hazzy995@hotmail.com
/*==============================*/

//Arguments
//==================
//sprite index, tile width, tile height, frame width, frame height, x , y
//drawFrame(sprite,32,32,200,200,x,y);

//Create Temp Variables
var __sprite, __tileWidth, __tileHeight, __frameHeight, __frameWidth, __x, __y;

__sprite = argument0;
__tileWidth = argument1;
__tileHeight = argument2;
__frameWidth = argument3;
__frameHeight = argument4;
__x = argument5;
__y = argument6;

//Draw the corners
//==================
//Top Left
draw_sprite_part_ext(__sprite,0,0,0,__tileWidth,__tileHeight,__x,__y,1,1,image_blend,image_alpha);
//Top Right
draw_sprite_part_ext(__sprite,0,__tileWidth,0,__tileWidth,__tileHeight,__x+__frameWidth-__tileWidth,__y,1,1,image_blend,image_alpha);
//Bottom Left
draw_sprite_part_ext(__sprite,0,0,__tileHeight,__tileWidth,__tileHeight,__x,__y+__frameHeight-__tileHeight,1,1,image_blend,image_alpha);
//Bottom Right
draw_sprite_part_ext(__sprite,0,__tileWidth,__tileHeight,__tileWidth,__tileHeight,__x+__frameWidth-__tileWidth,__y+__frameHeight-__tileHeight,1,1,image_blend,image_alpha);

//Draw outer edges
//==================
//Draw Top Edge
draw_sprite_part_ext(__sprite,0,__tileWidth/2,0,1,__tileHeight,__x+__tileWidth,__y,__frameWidth-(__tileWidth*2),1,image_blend,image_alpha);
//Draw Bottom Edge
draw_sprite_part_ext(__sprite,0,__tileWidth/2,__tileHeight,1,__tileHeight,__x+__tileWidth,__y+__frameHeight-__tileHeight,__frameWidth-(__tileWidth*2),1,image_blend,image_alpha);
//Draw Left Edge
draw_sprite_part_ext(__sprite,0,0,__tileHeight/2,__tileWidth,1,__x,__y+__tileHeight,1,__frameHeight-(__tileHeight*2),image_blend,image_alpha);
//Draw Right Edge
draw_sprite_part_ext(__sprite,0,__tileWidth,__tileHeight/2,__tileWidth,1,__x+__frameWidth-__tileWidth,__y+__tileHeight,1,__frameHeight-(__tileHeight*2),image_blend,image_alpha);

//Fill in the center
//==================
draw_sprite_part_ext(__sprite,0,__tileWidth/2,__tileHeight/2,1,1,__x+__tileWidth,__y+__tileHeight,__frameWidth-(__tileWidth*2),__frameHeight-(__tileHeight*2),image_blend,image_alpha);

Comments

ludamad 12 years, 7 months ago

Quote:

//Create Temp Variables
Commenting for the win! (But seriously, avoid commenting the obvious, just adds line noise, instead maybe explain the general purpose of those temporary variables.)

Also, once the competition is done, I'd love it if you consider helping out with my open source project ^-^. Your work is great. (I need graphics artist and high level lua programmers that will basically be content designers)

Harrk 12 years, 7 months ago

Quote:

Commenting for the win! (But seriously, avoid commenting the obvious, just adds line noise, instead maybe explain the general purpose of those temporary variables.)

I just commented on what I thought might require it, I didn't intend for my code to be used for a learning tool and so I didn't comment for it.

The goal was to go away and copy and paste it, just a function of usability really.

ludamad 12 years, 7 months ago

Some people comment -too- much. I did think you had an appropriate amount of commenting, I was just pointing out something that, according to best practices, should be left out in commenting. When I said 'maybe explain the general purpose', I really did mean 'maybe'. Descriptive variable names > comments.