Results 1 to 10 of 87

Thread: Space Shooter Game Editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Well, I almost got it I made the smooth scrolling possible like this :

    Code:
     procedure TTools.DOWN_1Execute(Sender: TObject);
    var i,j : integer;
    begin
      if MainForm.Offset < strtoint(LLength.Text)-14 then
        begin
          inc(MainForm.Reset_Grid,1);
          if MainForm.Reset_Grid = 32 then
            begin
              Main.DrawLevel;
              Main.SyncAnim;
              MainForm.Reset_Grid:=1;
              inc(MainForm.Offset,1);
              for j := 0 to 15 do
                begin
                  for i := 0 to 19 do
                    begin
                        BackGround[i,j].WorldY:=0;
                    end;
                end;
            end;
          for j := 0 to 15 do
            begin
              for i := 0 to 19 do
                begin
                    BackGround[i,j].WorldY:=BackGround[i,j].WorldY-1;
                end;
            end;
        end;
    end;
    Currently it only works for down, but has a small problem which I'm trying to fix now, when I start scrolling down with it goes down 32 , then does a jump that I can feel.... but after that I cannot feel that I'm drawing that one additional line , it feels like
    I'm actually scrolling trough a 30 line long map for example....
    Also my animation is reset as I move down .... which is not good...damn, have to find a fix for that to.

    But atleast did some progress on me own.

    UPDATE : if I set RESET_GRID on FormCreate to RESET_GRID:=31 (instead of 0), my scrolling down is as smooth as can be.... only animation remains problem now that it's synced whenever I move....not good will have to
    use you're suggestion to make em synced , hopefully I can make em synced and still keep the uniqueness of invidiual animations by using startpos by tile.

    Greetings
    Robert
    Last edited by robert83; 03-01-2013 at 02:06 AM.

  2. #2
    YEAAAHHH,

    Here it is, smooth scroll works in both directions up and down, only minor problem which I need to fix now is (not a big problem for my intended game since it's a space shooter which goes in one direction only) , when I change directions it's visible. I find it difficult to explain with my english knowledge. See for youreself.

    Anyway making some really nice progress (so I think atleast)

    Greetings
    Robert
    Attached Files Attached Files

  3. #3
    Quote Originally Posted by robert83 View Post
    YEAAAHHH,

    Here it is, smooth scroll works in both directions up and down, only minor problem which I need to fix now is (not a big problem for my intended game since it's a space shooter which goes in one direction only) , when I change directions it's visible. I find it difficult to explain with my english knowledge. See for youreself.

    Anyway making some really nice progress (so I think atleast)

    Greetings
    Robert
    From what I see the problem is that when you are moving UP your are not adding necessary line of sprites on uper side which makes that black line.

    Any whay now if you would excuse me I would like to go to bed as it is 3:41 am here now.
    Post any progress you made and I'll try to find some time tomorow to write you the whole map movment functions as explained in my previous post. I would also write you a Map file handling routines which would alow you to load several Layers when needed.

    EDIT: BTW I recomed you to start commenting your code. While at this time it might seem unnecessary to do this but when your code grows you will find out that you can quickly get lost in it and then don't know what which part of the code does.

  4. #4
    Hello,

    thank you , I will start commenting, and cleaning up the code, possibly using more units, try and categorize the procedures in units in a meaningfull easy to see manner.
    yeah now I see what you mean, though I'm way to tired to fully understand (went to sleep at 3:00 am, woke up at 06:30 am, at work now... will sleep today).
    if I understand you're map format would allow map file to be read line by line when needed ? instead of beaing read at once?
    once I get some sleep, I will modify the code, and I'll try to do it like you've told me .

    Now that I think about it, I will not overcomplicate my life. I'll reamove up and down by 1 , instead I will put a simple demo mode there, which when clicked on will jump to the end of the map, and from there move up by one till the end of the map. Just like it would later in the real game. And I think I will also add another variable into the map data.... scroll speed, migh come in handy if later I decide I want a map that is faster for some reason then the rest.... ligthspeed travel or escape from some boss, or something.

    Thank you for youre time, I'll post tomorrow on my progress.

    Greetings
    Robert

  5. #5
    You don't need to use more units. the only reason for using more uits is when you are trying to make part of the code so that it can be reusable in some other project of yours (you just add existing unit to another project).
    Also you don't need to make procedure or function for about everyting. You only use procedures or functions for comonly repeated parts of code.

    What I do suggest is simply use basic comenting of your code (you write simple coment on top of your procedure or series of source lines so nex time when you will look at that coude you will know what it is for.
    I'm not usre which development IDE are you using but if your development IDE supports using of Regions (available in Delphi XE or newer and in FPC) learn how to use them.
    The best feature of Regions is that they alow you to make foldable parts of your code and even name them. While regions don't affect the program execution they do provide a way to make your code easily redable.

    About scrolling capabilities while removing smoth capability to scroll your map up and down isn't needed for your editor do make sure that you leave yourself the ability to scroll by line othervise you will just make life for yourself a bit more compicated

  6. #6
    Damn I can't seem to get old Asphyre 3.1.0 eXtreme to sucsessfully compile on my Delphi XE3.
    Also the sprite engine itself is being dependant on some Units that are not present in newest Asphyre Sphinx so I can't get your sprite engine to work with newest Asphre engine.

    Which development IDE are you using anywhay?
    EDIT: Don't mind my last question I already got an answer using PE Explorer

    I gues I need to get my old laptop out of all that dust which acumulated over past years on it, fire up Delphi 7 and try to make precompiled packages for both Asphyre 3.1.0 eXtreme and SpriteEngine so I might be able to use them with Delphi XE3
    Last edited by SilverWarior; 04-01-2013 at 12:53 AM.

  7. #7
    Hello,

    thank you, I've modified myself the Asphyre eXtreme source I use, since dxbase.pas conflicted with devExpress components I use, attached I give you the modified Asphyre eXtreme sources directory zipped , only changed unit names where needed in order to work along with devExpress.

    Maybe I wasn't clear, I do intend to leave alone line by line scrolling for the editor.

    I only intend to remove smooth scrolling in both directions, that is not needed only complicates my life, I will be only scrolling one way trough the game world anyway. Will only keep smooth scrolling up. That is what I meant. The finel editor
    should allow me to test the level , so it would look like the real game, enemy ships comming down and shooting at the player , only the player would be not affacted by this . That reminds me, I will also need to specify for example if Layer3 will only include enemy ships and maybe power up's , I will need to specify in which direction and with which speed will they go, how many lives will they have etc...Will need to think this trough , but I think it would be logical and simple if the map data would hold enemy ship type , life, direction data no? (but this is a bit down on the road...)

    I'm using Delphi 7 SE , works fine on Windows 7 here.

    About the Units I've said, I wanted to seperate em like this, anything related to level loading, drawing etc... will be in unit level for example.
    Everything related to enemies will be in a unit enemies.

    Right now I have some programing to finish here for the company I work for, so I'll be back on programing this editor tomorrow hopefully.

    EDIT :

    meanwhile I've managed to test my editor, on a Duron 1400, SIS661FX_760_741, 512MB ram, Windows XP, got 30 FPS , only thing is in non full screen mode, the screen flickers ... on the Draw surface, but it dissapears in Full Screen mode, this is good. This is quiet a low spec system, Windows XP barelly works on it, not to mention the "GPU".

    Greetings
    Robert
    Attached Files Attached Files
    Last edited by robert83; 04-01-2013 at 06:41 PM.

  8. #8
    Is this about drawing visible map section of 2D grid? You don't need to add any variables to that for background class. It's just small tricks you do in the Draw (DrawLevel?) function.

    1) You have worldX, worldY: single, floating point coords yeah? To get deltaX, deltaY, you can use function frac() for frac(worldX), drac(worldY). I don't know about your scaling, but on all maps i have done, 1.0 value in coords matches size of 1 tile. So if i draw player on 0.5, 0.5, it's in the middle of first tile.

    2) Getting drawable area should be done from the rendering context, be it TForm, TPanel or TOpenGLContext. SX:=context.Width div TileWidth, SY:=context.Height div TileHeight.

    3) When it comes to drawing...
    Code:
    iX:=floor(worldX);
    iY:=floor(worldY);
    for j:=iY-1 to iY+SY do
      if (j>=0) and (j<SizeY) then
        for i:=iX-1 to iX+SX do
          if (i>=0) and (i<SizeX) then begin
            DrawTile(i-iX+deltaX, j-iY+deltaY, @tile[i, j]);
          end;
    That's just from memory though, should work without much modifications.
    Last edited by User137; 03-01-2013 at 10:23 PM.

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
  •