Sprites Won't Show Up

Discussion in 'Sega Discussion' started by SegaDev, Aug 13, 2015.

  1. SegaDev

    SegaDev Member

    Joined:
    Nov 14, 2014
    Messages:
    15
    Likes Received:
    0
    Hi guys,

    Still working on my incremental clicker game for the genny. Unfortunately i am having problems getting a single sprite to show even when using BigEvilCorporations framework. There doesn't seem to be any errors so my guess it's an addressing error of some sort. I double checked my code for typos and there doesn't seem to be any as far as i can tell. According to a thread i started the problem is:
    The problem is everything seems to be correct:
    First part is correct, the last part isn't
    Code:
    globals.asm
    
    ; center screen position
    centerscreen_position_x:  equ 0x00F0
    centerscreen_position_y:  equ 0x00F0
    
    memorymap.asm
    
    ; ************************************
    ; Game globals
    ; ************************************
    cursor_position_x  equ (audio_clock+SizeWord)
    cursor_position_y  equ (cursor_position_x+SizeWord)
    
    source.asm
    ; ************************************
      ; set the cursor position to the center of the screen
      ; ************************************
      move.w #centerscreen_position_x, (cursor_position_x)  ; Set cursor's x position
      move.w #centerscreen_position_y, (cursor_position_y)  ; Set cursor's y position
      
      ; ******************************************************************
      ; Main game loop
      ; ******************************************************************
    GameLoop:
    
      jsr WaitVBlankStart  ; Wait for start of vblank
    
      ; Set cursor's position
      move.w #cursor_id, d0  ; cursor sprite id
      move.w (cursor_position_x), d1  ; cursor's x position
      jsr SetSpritePosX  ; Set cursor's x position
      move.w (cursor_position_y), d1  ; cursor's y position
      jsr SetSpritePosY  ; Set cursor's y position
    
      jsr WaitVBlankEnd  ; Wait for end of vblank
    
      jmp GameLoop  
    
    That can't be right, I don't even think there's even enough space for that many tiles anyways:
    Code:
    spritedescriptiors.asm
    
    ; Sprite IDs
    cursor_id equ 0x0
    number_of_sprites equ 0x1
    
      ; Sprite descriptor structs
    sprite_descriptor_table:
    cursor_sprite:
      dc.w offscreen_position_y  ; Y coord (+ 128)
      dc.b CursorDimensions  ; Width (bits 0-1) and height (bits 2-3) in tiles
      dc.b 0x00  ; Index of next sprite (linked list)
      dc.b 0x00  ; H/V flipping (bits 3/4), palette index (bits 5-6), priority (bit 7)
      dc.b CursorTileID  ; Index of first tile
      dc.w offscreen_position_x  ; X coord (+ 128)  
    
    Um shouldn't it be palette 0 color 0, and no it's not supposed to be a brown squire it's supposed to be a cursor?
    Code:
    assets/sprites/cursor.asm
    
    Cursor:
    
       dc.l   0x00055000  ;  XX  
       dc.l   0x00500500  ;  X  X 
       dc.l   0x05000050  ;  X  X
       dc.l   0x50000005  ; X  X
       dc.l   0x50000005  ; X  X
       dc.l   0x55500555  ; XXX  XXX
       dc.l   0x00500500  ;  X  X 
       dc.l   0x00555500  ;  XXXX 
    
    assets/palette/palettes.asm
    
    Palette:
       dc.w 0x0000                 ; Colour 0 - Transparent
       dc.w 0x000E                 ; Colour 1 - Red
       dc.w 0x00E0                 ; Colour 2 - Green
       dc.w 0x0E00                 ; Colour 3 - Blue
       dc.w 0x0000                 ; Colour 4 - Black
       dc.w 0x0EEE                 ; Colour 5 - White
       dc.w 0x00EE                 ; Colour 6 - Yellow
       dc.w 0x008E                 ; Colour 7 - Orange
       dc.w 0x0E0E                 ; Colour 8 - Pink
       dc.w 0x0808                 ; Colour 9 - Purple
       dc.w 0x0444                 ; Colour A - Dark grey
       dc.w 0x0888                 ; Colour B - Light grey
       dc.w 0x0EE0                 ; Colour C - Turquoise
       dc.w 0x000A                 ; Colour D - Maroon
       dc.w 0x0600                 ; Colour E - Navy blue
       dc.w 0x0060                 ; Colour F - Dark green
    
    I am linking to the source code as reference in hopes one of you can figure it out, cause right now i'm stumped and very discouraged though it isn't gonna stop me. Any assistance in this matter would be greatly appreciated.

    Sincerely,

    SegaDev
     
  2. MottZilla

    MottZilla Champion of the Forum

    Joined:
    Feb 1, 2006
    Messages:
    5,066
    Likes Received:
    102
    Wouldn't being at 0,265 make the sprite entirely off screen? Usually I see coordinates listed as X,Y and that would make the sprite beyond the last rendered scanline, atleast in NTSC. And in the 32 tile wide mode (256 pixel) you'd also be off screen if you were meaning Y,X coordinate.

    Don't give up.
     
  3. SegaDev

    SegaDev Member

    Joined:
    Nov 14, 2014
    Messages:
    15
    Likes Received:
    0
    Like i said, I'm using a framework and it's telling me to use YX. The thing is even if i change the constant for the center of the screen to:
    Code:
    ; center screen position
    centerscreen_position_x:  equ 0x00A0
    centerscreen_position_y:  equ 0x00A0
    
    It theoretically should change the sprite position to 185,185 but instead it shows as 0,185 with the same tile id(1786) which is wrong anyways. So regardless of what i change the positions to they aren't correct either way. I'm hoping someone here can figure it out as I'm out of ideas.

    Sincerely,

    SegaDev

    Update: setting the sprite's y position manually doesn't seem to work
    Update 2: Neither does setting the tile id manually
    Update 3: Changing the tile id rin spritesdescriptors.asm esults in a multiple of 256 so manually entering tile id 1 results in 256, 2 results in 512, 3 results in 768 which seems wrong to me.
     
    Last edited: Aug 14, 2015
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page