News:

Function Finder  Find all the functions within source code files

Main Menu

Pre-planning your project

Started by medwayman, January 13, 2006, 06:00:29 PM

Previous topic - Next topic

Makeii Runoru

I think in my view of programming with Play Basic since Day 1, I have learned that everything I make should represent an object, as it is implied in Object-Oriented Design. Very rarely will I have a lone variable that is outside of a type or function.

Generally, I organize my project into appropriate tabs:
-- Startup
-- Images
-- Sounds
-- Objects
-- Object Events
-- Loop


Startup:
-- Defines the game's protocols (window length/width, framerate, max image quantity, #include, etc)

Images:
-- Holds all the images that is used for the project. However, I DO NOT refer to images by their image index. Instead, I create my own function for loading images and grabbing new images from loaded ones.
example:
CONSTANT COLOR_TRANS = RGB(253,0,253)
blue_flag = Load_T_Image("blueflag.bmp", COLOR_TRANS)
^: Now, if I ever need to refer to the image, I will use blue_flag instead of the number.

Sounds:
-- Same as images, sort of...

Objects:
-- Holds the types and Dimmed objects of the game.
example:
type t_character
  active
  x
  y
  dir
  .....
endtype
Dim Character as t_character

Object Events:
-- Holds the FUNCTIONS that are associated with the objects respectively
example:
Function Character_Move(amt_x, amt_y, dir)
  Character.x = Character.x + amt_x
  Character.y = Character.y + amt_y
  Character.dir = dir
endfunction

Function Character_Draw()
  drawimage my_character, Character.x, Character.y, on
endfunction
(( Realistically, I would stick Character_Draw() in a do loop ))


Loop:
-- Holds the Initial functions required to start the same (usually functions I have created for loading maps, initiating characters, and whatnot). Then followed by the do loop which holds functions that alter the behavior of the objects (Object Events).
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.