|
V2 Newbie needs help with menu system... Displaying 1-6 of 6 total.
1
MrSaturn
|
I've only started programming with V2 recently, so I really don't have much of an idea what I'm doing yet... anyway, I've been fooling around with creating a simple menu system, but I can't get it to work!
The problem arises when displaying the background. It loads two .pcx files, one for where the characters are displayed and one for where the menu selections are displayed (like Final Fantasy games). Individually, they both work fine; however, if I try to load them both, they appear garbled and warped.
I have a feeling this stems from my limited understanding of the CopySprite functions, but I don't know what to do about it... here's the code I'm using.
void MainMenu()
{
int x, y, menuimg1, menuimg2;
menuimg1 = LoadImage("charmenu.pcx");
menuimg2 = LoadImage("menubar.pcx");
UnPress(3);
while (!b3)
{
Render();
x=ScreenX-80;
y=0;
CopySprite(0, 0, image_width, image_height, menuimg1);
CopySprite(x, 0, image_width, image_height, menuimg2);
GotoXY(x+5, y+5); PrintString(0, "Items"); y+=FontHeight(0);
GotoXY(x+5, y+5); PrintString(0, "Equip"); y+=FontHeight(0);
GotoXY(x+5, y+5); PrintString(0, "Magic");
ShowPage();
UpdateControls();
}
UnPress(3);
free(menuimg1);
free(menuimg2);
}
Any help in this area would be appreciated.
Posted on 2001-05-31 17:04:41
|
TheGerf
|
When you use image_width and image_height, it uses the values of the LAST OPENED image. Since you have two ative images, it shoould be using funky values. Try to use the exact widths and heights as numbers, like 260,240 or whatever.
TheGerf, not just any gerf.
Posted on 2001-05-31 23:06:52
|
andy
|
image_width and image_height are ordinary variables basically, with the single exception that they're written to when you load an image. You have to do something like this:
int img_ptr0,img_ptr1; // data pointer
int img_x0,img_x1; // widths
int img_y0,img_y1; // heights
img_ptr0=LoadImage(...);
img_x0=image_width; img_y0=image_height;
img_ptr1=LoadImage(...);
img_x1=image_width; img_y1=image_height;
copysprite(blah,blah,img_x0,img_y0,img_ptr0);
copysprite(blah,blah,img_x1,img_y1,img_ptr1);
'Never confuse a single defeat with a final defeat.' -F. Scott Fitzgerald
Posted on 2001-06-02 10:14:16
|
MrSaturn
|
Thanks for the help... after fooling around with it for a while, I did eventually get it working like I wanted. :)
Another question:
When I first made my TextBox() command, entities would stop animating whenever it was called. Then, I added a loop containting the ProcessEntities() funtion, which fixed the problem--but created another, worse one. Now, I can't get the entity that's talking to stand still and face the player! What am I doing wrong?
Posted on 2001-06-02 12:28:38
|
MrSaturn
|
You'll have to excuse the formatting. Stupid forums...
void TextBox(string filename, string line1, string line2, string line3, string line4)
{
int boximg, portraitimg, prtbgimg, yposition;
UnPress(1);
Render();
while(!b1)
{
while(timer)
{
timer--;
ProcessEntities();
}
Render();
yposition=ScreenY-(ScreenY/3);
boximg=LoadImage("textbox.pcx");
TCopySprite(0, yposition, image_width, image_height, boximg);
prtbgimg=LoadImage("portbox.pcx");
TCopySprite(0, yposition-image_height, image_width, image_height, prtbgimg);
portraitimg=LoadImage(filename);
CopySprite(5, yposition-image_height-5, image_width, image_height, portraitimg);
GotoXY(7, yposition+7); PrintString(0, line1); yposition+=FontHeight(0);
GotoXY(7, yposition+7); PrintString(0, line2); yposition+=FontHeight(0);
GotoXY(7, yposition+7); PrintString(0, line3); yposition+=FontHeight(0);
GotoXY(7, yposition+7); PrintString(0, line4); yposition+=FontHeight(0);
ShowPage();
UpdateControls();
}
UnPress(1);
free(boximg);
free(portraitimg);
free(prtbgimg);
}
Posted on 2001-06-02 12:32:50
|
Kazier989
|
you have to modify the movescript for the entity your talking to so that it just stands and faces in the proper direction, and then when the player is done talking the entity's old movescript is restored.
I don't have the VC docs handy so I can't help you with source, unfortunately... :D
Check out my homepage.
Posted on 2001-06-03 15:02:16
|
Displaying 1-6 of 6 total.
1
|
|