Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / positoning bmp's how is it done??

Author
Message
coolbelt
22
Years of Service
User Offline
Joined: 7th Oct 2002
Location:
Posted: 8th Oct 2002 06:25
as my subject reads...how is it possible to positoin a BMP? i am trying to make a menu, to that of final fantasy games, and i need help with this...Thank you for you help.

-Nathanial Lee-
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 8th Oct 2002 20:31
Nathanial,

Have you tried using sprites? I think that you'll find that this is largely what you are looking for.

One strategy that you can use is to have the various menus you need stored into a bitmap. When your program is loading up, load a bitmap with LOAD BITMAP and then use the GET IMAGE command to get all your menus stored in memory.

During the actual game loop, use the SPRITE command to position your menus. Your sprites will be displayed over your 3D world.

If you want your menus along the right side (or the bottom, if you modify the trick) you should cache your screen co-ordinates when your game is loading too.

w = screen width()
h = screen height()

This way, you can do things like:
SPRITE 1, w-100, 0, 1
(this assumes you are placing sprite number 1, generated from image number 1, that it is 100 pixels wide and that you want it at the top of the screen).

A more advanced way to do it is to use user defined TYPES. These are your powerful friends that can store related data fields, and the beauty is that you get to choose what data they store. Here's how you can do that:

TYPE MenuDefinition
MenuName AS STRING
X AS INTEGER
Y AS INTEGER
ImageNumber AS INTEGER
SpriteNumber AS INTEGER
Visible AS INTEGER
ENDTYPE

You could then create an array of menus to use at various points through the game.

DIM GameMenus(10) AS MenuDefinition

Now, if you can write one function to draw all menus that are to be displayed, and you'll never have to worry about fancy switches or tons of repeating code.

FUNCTION DrawMenus()
FOR i = 1 TO 10
IF GameMenus(i).Visible = 1
SPRITE GameMenus(i).SpriteNumber, GameMenus(i).X, GameMenus(i).Y, GameMenus(i).ImageNumber
ENDIF
NEXT i
ENDFUNCTION

Hope this helps!

-= i only do what my rice krispies tell me to do =-
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 15th Oct 2002 05:17
Hey- I am as well making a menu like Final Fantasy. Here is how I positioned my bitmap.

rem load image and position
load image "______.bmp",1
Paste image 1,x,y

that easy.

If you want my code for my entire menu (its just visual so far, no sub directories like items or equipment) Id be glad to give it to you

I have a problem making it so I can go to sub directorys (eg. Items, Equipment) If you have made it past this problem, could you help out a fellow programmer?

RPGgamer

Final Fantasy, best series ever made

Login to post a reply

Server time is: 2024-11-23 16:26:28
Your offset time is: 2024-11-23 16:26:28