Results 1 to 10 of 87

Thread: Space Shooter Game Editor

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #32
    Quote Originally Posted by robert83 View Post
    For the BAD news , where to I do that ? on Form.Create ?
    Is this that DANGEROUS thing ?
    Code:
      AsphyreDevice1.Height:=480;     // Asphyre Height
      AsphyreDevice1.Width:=640;      // Asphyre Width
    
      AsphyreDevice1.WindowHandle:=Panel1.Handle;    // Asphyre uses Panel1 as rendering surface
      AsphyreDevice1.Initialize;                    // Initialization
      if AsphyreDevice1.Initialized = false then      // if failes displays message and terminates program
        begin
         ShowMessage('Error initializing Asphyre!');
         Close;  // <---- if the the initialization fails , program closes
        end;
    
    
      ASDB1.FileName:=ExtractFilePath(Application.ExeName)+'TileSet.asdb';  // path to databse ( tilesets )
      SpriteEngine := TSpriteEngine.Create;                                 // Creates the SpriteEngine
      SpriteEngine.Image:= Images;                                          // Sets SpriteEngine to use Image source
      SpriteEngine.Canvas:= AsphyreCanvas1;                                 // Sets SpriteEngine to use AsphyreCanvas
      Selection := TSelection.Create(SpriteEngine);                         // Creates the Selection Squire
    Yes. For some reason Close doesn't end the Application execution when expected. Usually you use Application.Terminate instead.
    Also if you take a look at TAsphyreDevice component you will notice that it has OnInitialize event. That event can be used for aditional initialization procedures. So you can move all the stuff needed for SpriteEngine initialization into that even procedure.

    Quote Originally Posted by robert83 View Post
    For the speed I'm not quiet sure how should I add it to this ? Quote: "As for controlling the scroll speed I was thinking about storing the information about scroll speed in the TLine itself so that when you create specific line of sprites you also check if scroll speed should be adjusted."
    I was thinking of adding another variable in TMapLine record.

    Quote Originally Posted by robert83 View Post
    As for the Layers ... the one you mentioned makes sense... but I don't even know where to begin . Texture layering sounds good, only problem is I have no idea how to implement.

    I would probably have to change my Map record a bit...
    I was thinking of redesignign Map record entirely but haven't figured out how exactly yet.

    Quote Originally Posted by robert83 View Post
    Now I'm really starting to get lost in them Arrays, will have to start drawing I guess ....
    Yes multidimensional arrays can be a bit puzeling. All you have to do is learn how to think out of the box to fully understand them.
    This might help you a bit:
    Records (TTileData) are sheets of paper.
    Lines (TMapLine) are books containing this sheets of paper.
    Layers are shelves on which you have all theese books.
    Map(TMap) is a library with all theese shelves.


    Quote Originally Posted by robert83 View Post
    Now if I understood you correctly , we might get away with somehow only using 320 sprite's and adding to them all the layers? (1,2,3,4,5,6...n) (instead of creating 320 sprites for each layer ) .
    Unfortunately we would need to create specific sprites for each layer. Good news is that upper layers won't need to have full grid of sprites but would have sprites only on certain positions so final count of sprites wont be 320 * number of layers.

    Quote Originally Posted by robert83 View Post
    Unfortunately I don't know how to begin, how can I later say edit only layer2 sprites even if I have layer3,layer4 or layern on "top" of it . Was trying to google (damn Asphyre ... always brings up ACER laptops, and only a few valuable hits...)
    From what I see you manually calculate map position which needs to be updated on mouse click. That is good as you only need to add additional condition which determines which layer are you editing.


    Anywhay I have decided to go and redesign map record so it will support multiple layers.
    I plan on designing layers in a whay so that they can have varios sizes, both in lenght as in sprite sizes used in them (hopefully it would alow us to implement paralax scrolling).
    I would redesign scrolling procedure so it would be compatible with new layer types.
    I would need to design map file routine to support storing all this information in organized manner (maped file approach). Don't wory I will also write short documentation explaining how this works so you could do futher changes in the future.

    I also plan on adding some other tweaks to your code.
    For instacne you are currently calculating your mouse position inside AsphyreTimer1.Process event procedure while you could easily just use TPanels OnMouseMove event to do so.
    And to determine if mouse is over panel you could simply use TPanels OnMouseEnter and OnMouseExit events to detect when mouse is moved over panel and when away from it. The best thing about theese events is that they also detect if mouse moves over some other window which is positioned above your Panel.
    EDIT: OnMouseEnter and OnMouseExit events are unfortunately not present in Delphi 7.
    Last edited by SilverWarior; 19-01-2013 at 05:04 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •