Jump to content

Lavalamp

Members
  • Content Count

    164
  • Joined

  • Last visited

Posts posted by Lavalamp


  1. That would be ROM. When you import a map or graphics you're essentially just defining the raw data for some part of the chip that gets burned, so where code is converted to a numerical representation, data is just copied across. As RAM is volatile you can't assume data will be there until you write it there. So if you have data representing tile values in a level, you can define that as data in the ROM, then when the game starts you can copy that data to a section of RAM that you've designated as being where the tiles are read from during the game. If you draw a tile-map that's pointing at the tiles in ROM it'll never change because you can't change ROM, but if you draw a tile-map pointing at your copy in RAM you can do all sorts of things with it and change it on the fly.

     

    As the 7800 doesn't have a colour-map like machines with a more traditional tile based display when you plot your maps they will always have the same palette regardless of what you change your tiles to unless you clear and redraw your map.

     

    I apologise for the rambling, I'm not sure if I've made any sense.

     

    Thanks heaps that makes things a lot clearer :) I need to re-look at maps and re-engineer my game, there was a PLOTMAPFILE.BAS sample that shows three tilesets being using for multiple colours which appeals. I saw that SCROLL.BAS too which is amazing and would match my platformer well.


  2. Depends on whether "map1" is a ROM data statement, or some bytes of RAM. plotmap works with both, so I can't tell what you're doing from just the plotmap command.

     

    If it's ROM (ie. "map1" is the label from a data statement) then you can't pokechar. If it's RAM, then sure.

     

    For a ram-based plotmap example, there's a "ramcharmap" in the 7800basic sample directory.

     

    I'm using the below is this RAM or ROM?

    incmapfile level_1.tmx
    

    Im thinking about swapping to using data statements so I can have colored tiles and tiles I can modify.


  3. Assuming "map1" is a ram location, you don't have to re-plot. You can just restore the ram contents however you populated them in the first place. e.g. plotchars, memcpy, etc.

     

    This was with the plotmap map1 0 0 0 20 12 can i not use pokechar map1 TileX TileY 20 12 $30 to flip a tile?


  4. resolved my missing rat issue :)

     

    Another question the if you use the POKECHAR do you need to then re-plot the screen and save it again for the restore command? this is to change a tile.

    pokechar map1 TileX TileY 20 12 $30 
    

  5. Have you imported multiple 'rat' images? The frame parameter is optional but depending on what's in the ratFrame array it might be drawing an empty image.

    Also keep in mind that large x and y values will 'draw'the sprite outside of the visible screen area

     

     

    Its a bit weird, yes has multiple images, I only briefly looked at it last night, Ill do some more troubleshooting over the weekend.

     incgraphic rat1.png
     incgraphic rat2.png
     incgraphic rat3.png
    

  6. You can use plot any given sprite image as many times as you like.

     

    In your example you don't modify the x and y in the loop, which would result in 5 "enemy" images at the exact same location. Maybe that's your issue?

     

     

    Thanks was just a quick type up, i'm not seeing any turn up at this point.

     

    code is:

     for check = 0 to rats
     tempX = ratX[check] : tempY = ratY[check]
     tempFrame = ratFrame[check]
     plotsprite rat1 4 tempX tempY tempFrame
     next
    

  7. Works for me. I did a quick sanity check...

     

     a=5
     b=0
     if a=5 then for x = 0 to 3:b=b+2:next
    
            displaymode 320A
    main
            clearscreen
            plotchars 'b=' 0 5 0
            plotvalue ascii 0 b 1 16 0
            drawscreen
            goto main
    
    Which spits out "b=8" if a=5, and "b=0" otherwise, as expected.

     

     

     

    Thanks for checking :)

     

     

    Also with sprites I have made an assumption that maybe wrong....

     For num_enemy = 0 to 4
       plotsprite enemy 0 x y frame
     next
     

    Can you only use the image once? The guide doesn't specify this. cheers.


  8. The "soundtest" program in the 7800basic samples directory has 25 different sound effects. You're welcome to use them as-is, or modify as you see fit.

     

    I don't believe anybody else has released a TIA sound-effect library, for the 7800 or 2600.

     

    Fantastic, Ill check this out. Thanks!

    • Like 1

  9. Hi, I'm having issues with implementing arrays in 7800Basic, the online manual appears to have an example that makes no sense to me, it doesn't show how to declare an Array?

     

    http://www.randomterrain.com/7800basic.html#dimensioning_variable_names

     

    Variable Arrays

    Regular variables can be accessed as arrays in 7800basic. Doing so will access memory locations next to the variable in question.

    The following sets variables "a", "b", and "c" to 0.

    a[0]=0
    a[1]=0
    a[2]=0
    Using array notation will allow you to loop through elements without a lot of duplicated code, providing you've used dim to place the elements side by side in memory.

     

     

    I assume to declare its like my example below?

     dim enemyX[0] = var1
     dim enemyX[1] = var2
     dim enemyX[2] = var3
    
    

    this means I can loop through them like this?

    for temp1 = 0 to 2
      if enemyX[temp1] >160 then enemyX[temp1] = 0
    next
    

    Also...getting the _length of data appears to be unclear to me, I get an error about it been before the data statement or something...

     

     

     


  10. You are correct in thinking that drawscreen should be called after you've finished plotting everything for the frame. It does a bit of setup and waits until the screen finishes drawing which is where your delay might be.

    I think what might be actually happening is that the rest of your code takes slightly too long so that the 7800 is already drawing the next frame before drawscreen is called, so drawscreen would have to wait for the screen to finish, wait for vblank to finish, and then continue at the start of the NEXT frame.

     

    A strategy to make the most of the time you have on each frame is to have all of your logic at the start of your loop, then restore the screen, then do all your plotting, then drawscreen. What you don't want to do is have anything graphics related near the start because 7800BASIC will wait for the screen to finish drawing before making changes to prevent the display being scrambled while it's being drawn, meaning all your code has to finish within the small amount of time that vblank takes.

    For example, if your drawplayer routine does anything not directly related to drawing then that code can be run earlier in the loop during the visible screen time leaving just the plotting to be done between frames.

     

     

    Thanks I will re-engineer the code based on your recommendations, makes sense. I'll introduce you guys to my game Morph once I have the basics controls and collision detection working. Thinking about it I think my STOS Game Makers manual has a good example of this.


  11. If you're just using plotmap then unless you're redrawing the display over and over it shouldn't have much of a noticeable difference. If you're using plotmapfile then that's another story, because plotmapfile allows drawing tiles with different pallettes it has to manage a new object for each pallette change.

     

    It's hard to say what the problem is without looking at the rest of the code but it shouldn't just be because you're using a tilemap.

     

    The DRAWSCREEN command below was the culprate, I thought this needed to be called after plotting sprites?

    main_loop
     BACKGRND=$00
     restorescreen
     globalFrameCount = globalFrameCount + 1
     if globalFrameCount = 30 then globalFrameCount = 0
     if globalFrameCount = 15 then gosub moveplayer
     gosub drawplayer
     rem drawscreen
     goto main_loop
    

  12. If you're just using plotmap then unless you're redrawing the display over and over it shouldn't have much of a noticeable difference. If you're using plotmapfile then that's another story, because plotmapfile allows drawing tiles with different pallettes it has to manage a new object for each pallette change.

     

    It's hard to say what the problem is without looking at the rest of the code but it shouldn't just be because you're using a tilemap.

     

     

    Thanks that's what I conlcuded, but its performing badly with the tile code removed so something I have introduced has done something. But its pretty clean early code so dunno. I got the map to appear so CHARACTERSET was the missing piece thanks! I didn't know that PLOTMAPFILES allowed the multi pallette support, nice!


  13. Hi Peeps, having issues with getting tiling to work, the below results in a black screen...what have i missed? The Map has tiles set to emended and is XML, 8x16, and 20 x 12 in size. Thanks guys.

     set doublewide on
     set basepath gfx_morph
     set romsize 48k
     set tv pal
     displaymode 160A
    
     rem Color Palettes
     P0C1=$02: P0C2=$06: P0C3=$0F : rem grey, light grey & white
    
     rem Graphics Import
     incgraphic tileset_level_1.png
     incmapfile level_1.tmx
    
    main_init
     clearscreen
     plotmap level_1 0 0 0 20 12
     savescreen
     drawscreen
    
    main_loop
     BACKGRND=$00
     restorescreen
     drawscreen
     goto main_loop
    
    

  14. Thanks guys, I do have one perplexing issue, Ill try to get to the bottom of it and post what I find, after copying all my code to a test file and removing blocks of code out one by one, discovered doesn't like the line highlighted with <<<..

    rem Invaders
    set doublewide on
    set basepath gfx_invaders
    set romsize 48k
    set hssupport $7272 : rem temp UID for Game.
    displaymode 160B
    
    dim frameCount   = var1
    dim invaderX     = a.b
    dim invaderY     = var2
    dim invaderFrame = var3
    dim invaderCount = var4
    dim invaderMove  = c.d
    dim playerX      = e.f
    dim playerY      = var5
    dim playerShotX  = var6
    dim playerShotY  = k.l
    dim playerFired  = var7
    dim playerSpeed  = var8
    dim moveX        = g.h
    dim tempX        = i.j
    dim ufo          = var9
    dim ufoX         = m.n
    dim ufoSpeed     = o.p
    dim ufoFrame     = var10
    dim ufoShotX     = q.r
    dim ufoShotY     = s.t
    dim ufoFired     = Var11
    dim midX         = var12
    dim midY         = var13
    
    const true       = 1
    const false      = 0
    const screenH    = 192
    const screenW    = 160
    
    P0C1=$02: P0C2=$06: P0C3=$0F
    
    incgraphic player.png
    incgraphic player_shot.png
    incgraphic space_invader1.png
    incgraphic space_invader2.png
    incgraphic ufo1.png
    incgraphic ufo2.png
    incgraphic ufo3.png
    incgraphic ufo_shot.png
    incbanner paused.png
    
    maininit
    clearscreen
    midX         = screenW / 2
    midY         = screenH / 2
    playerSpeed  = 0.1
    playerX      = midX - 8
    playerY      = screenH - 16
    invaderX     = 0.0
    invaderY     = 16
    invaderMove  = 0.2
    invaderFrame = 0
    frameCount   = 0
    moveX        = 0.0
    invaderCount = 4
    playerFired  = false
    ufo          = false
    ufoSpeed     = 0.6
    ufoFrame     = 0
    ufoFired     = false <<<
    ufoShotX     = 0.0
    ufoShotY     = 0.0
    savescreen
    drawscreen
    ...
    
    

  15. A question on timing of sprite movement in 7800Basic, I traditionally use decimal for controlling speed. 7800Basic supports this, but is it better to use a frame counter to trigger a move? Recommendations welcome! Thanks.

    Speed = 0.2
    X = X + Speed
    
×
×
  • Create New...