Jump to content

Retro Lord

Members
  • Content Count

    367
  • Joined

  • Last visited

Posts posted by Retro Lord


  1. Okay, hm. I still get a syntax error. Man this is difficult.

     

    I did the dim:

       dim _dragon_xpos = k
    

    And I added:

       If player0x > player1x then _dragon_xpos = player0x - player1x : if _dragon_xpos < 5 then m=10 : goto __Skip_Proximity
       If player1x > player0x then _dragon_xpos = player1x - player0x : if _dragon_xpos < 5 then m=10 : goto __Skip_Proximity
    
    __Skip_Proximity
    
    

  2. Hm, I'm experimenting with this code but I always get an error message. Do I need to setup _My_Temp01 anywhere ellse then in this line of code?

        If player0x > player1x then _My_Temp01 = player0x - player1x : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player1x > player0x then _My_Temp01 = player1x - player0x : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player0y > player1y then _My_Temp01 = player0y - player1y : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player1y > player0y then _My_Temp01 = player1y - player0y : if _My_Temp01 < 5 then m=10
    
    __Skip_Proximity
    
    

     

    Entire source:

       rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288
    
       include div_mul.asm
    
    
    TITLE
    
     playfield:
     ..XX..XXX.XXX.XX..XXX.XXX..XX...
     ..X.X.XX..XXX.X.X.X.X.X.X..X....
     ..XX..X.X.X.X.XXX.XXX.X.X.XX....
     ................................
     ..............XXX...............
     ..............X.X...............
     ..............X.X...............
     ................................
     XX..X.X.XXX.XX..XXX.XXX.XXX..XX.
     X.X.X.X.X.X.X.X.XX..X.X.X.X..X..
     XX..XXX.X.X.XXX.XXX.XXX.X.X.XX..
    end
    
    
    
     COLUPF=rand
    
     drawscreen
    
     if joy0fire goto charselect
    
     goto TITLE
    
    
    
    
    charselect
    
     player0x=81 : player0y=49
    
     if j=0 then COLUP0=$2E
      if j=1 then COLUP0=$AE
      if j=2 then COLUP0=$52
     COLUPF=rand
    
        if j=0 then player0:
            %00000000
            %00101000
            %00101000
            %00010000
            %01111000
            %01000000
            %01010000
            %01010000
    end
    
     if j=1 then player0:
            %00000000
            %01111000
            %01010000
            %01010000
            %01111000
            %01000000
            %00010000
            %01011000
    end
    
     if j=2 then player0:
            %00000000
            %00101000
            %00101000
            %00010000
            %01111000
            %01000000
            %01010000
            %00010000
    end
    
     playfield:
     ................................
     ................................
     ................................
     ..............XXXXXX............
     ..............X....X............
     XXXXXXXXXXXXXXX....XXXXXXXXXXXXX
     ..............X....X............
     ..............XXXXXX............
     ................................
     ................................
     ................................
    end
    
    
    
    
    
    
     drawscreen
    
     if joy0up then j=0
     if joy0down then j=1
     if joy0left then j=2
    
     if joy0up && joy0fire then goto START : COLUPF=rand
     if joy0down && joy0fire then goto START : COLUPF=rand
     if joy0left && joy0fire then goto START : COLUPF=rand
    
    
     goto charselect
    
    
    
    
    
    
    
    
    START
    
       dim _Bit0_JoyU = a
       dim _Bit1_JoyD = a
       dim _Bit2_JoyL = a
       dim _Bit3_JoyR = a
       dim _PF_LR = f
       dim _PF_UD = g
       dim _classes = j
    
       player0x = 76
       player0y = 72
    
     missile0x=120
     missile0y=60
    
     player1x=rand
     player1y=rand
    
     scorecolor=$0E
    
     pfscorecolor = rand
    
     const pfscore=1
    
       pfscore1 = 21
     pfscore2 = 255
    
    
       _PF_LR = (player0x-15)/4
       _PF_UD = (player0y/8)-1
    
    
       rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
    
    
          player1:
            %00000000
            %00101000
            %00111100
            %00011000
            %00111000
            %00000100
            %00111000
            %00011000
    end
    
    
    
    
    
    
    
       playfield:
       ................................
       ..........XXXXX..XXXXX..........
       ..........X..........X..........
       ..........X..........X..........
       ..........X..........X..........
       ..........X..........X..........
       ..........X..........X..........
       ..........X..........X..........
       ..........X..........X..........
       ..........XXXXX..XXXXX..........
       ................................
    end
    
    
    __Main_Loop
    
    
     rem Missile0 = spikhal
     rem player1 = drake
     rem missile1=
    
     missile0height=7
     NUSIZ0=$20
    
     if j=0 then COLUP0=$2E
      if j=1 then COLUP0=$AE
      if j=2 then COLUP0=$52
    
     if collision(player0,missile1) then goto PIT
    
       ballheight = 7
       CTRLPF = $21
    
     h=h+1
    
        If player0x > player1x then _My_Temp01 = player0x - player1x : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player1x > player0x then _My_Temp01 = player1x - player0x : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player0y > player1y then _My_Temp01 = player0y - player1y : if _My_Temp01 < 5 then m=10 : goto __Skip_Proximity
       If player1y > player0y then _My_Temp01 = player1y - player0y : if _My_Temp01 < 5 then m=10
    
    __Skip_Proximity
    
     rem Walk
       if n > 0 then AUDV0 = 15 : AUDC0 = 1 : AUDF0 = 5 : n = n - 1: if n = 0 then AUDV0 = 0
    
    
     rem Dragon
       if m > 0 then AUDV0 = 15 : AUDC0 = 2 : AUDF0 = 10 : m = m - 1: if m = 0 then AUDV0 = 0
    
     rem Pit
       if p > 0 then AUDV0 = 15 : AUDC0 = 3 : AUDF0 = 13 : p = p - 1: if p = 0 then AUDV0 = 0
    
     if h=255 then pfscore2=pfscore2/4 : h=0
    
     if player0x<60 then player0x=60 : _PF_LR = _PF_LR + 1
     if missile1x<60 then missile1x=rand
     if player1x<60 then player1x=rand
    
     if player0x>96 then player0x=96 : _PF_LR = _PF_LR - 1
     if missile1x>96 then missile1x=rand
     if player1x>96 then player1x=rand
    
    
     if player0y<24 then player0y=24 : _PF_UD = _PF_UD + 1
     if missile1y<24 then missile1y=rand
     if player1y<24 then player1y=rand
    
     if player0y>72 then player0y=72 : _PF_UD = _PF_UD - 1
     if missile1y>72 then missile1y=rand
     if player1y>72 then player1y=rand
    
     COLUP1=$00
    
     missile1height=8
    
       if !joy0up then _Bit0_JoyU{0} = 0 : goto __Skip_Fire
    
       if _Bit0_JoyU{0} then goto __Skip_Fire
    
       _Bit0_JoyU{0} = 1
    
       player0y = player0y - 8
    
       _PF_UD = _PF_UD - 1 : n=10
    
    __Skip_Fire
    
    
       if !joy0down then _Bit1_JoyD{1} = 0 : goto __Skip_Fire2
    
       if _Bit1_JoyD{1}  then goto __Skip_Fire2
    
       _Bit1_JoyD{1} = 1
    
       player0y = player0y + 8
    
       _PF_UD = _PF_UD + 1 : n=10
    
    __Skip_Fire2
    
    
    
    
       if !joy0left then _Bit2_JoyL{2} = 0 : goto __Skip_Fire3
    
       if _Bit2_JoyL{2} then goto __Skip_Fire3
    
       _Bit2_JoyL{2} = 1
    
       player0x = player0x - 4
    
       _PF_LR = _PF_LR - 1 : n=10
    
    
    __Skip_Fire3
    
    
    
    
       if !joy0right then _Bit3_JoyR{3} = 0 : goto __Skip_Fire4
    
       if _Bit3_JoyR{3} then goto __Skip_Fire4
    
       _Bit3_JoyR{3} = 1
    
       player0x = player0x + 4
    
       _PF_LR = _PF_LR + 1 : n=10
    
    
    __Skip_Fire4
    
    
       rem 12-21 across
       rem 3-9 vertical
    
    
       if joy0fire then pfpixel _PF_LR _PF_UD off : goto __Skip_PF
    
       pfpixel _PF_LR _PF_UD on
    
    __Skip_PF
    
       drawscreen
    
       goto __Main_Loop
    
    
    PIT
    
     player0x=80 : player0y=20
     missile0x=200 : missile0y=200
     player1x=200 : player1y=200
     missile1x=200 : missile1y=200
     ballx=200 : bally=200
    
    
    fall
    
     COLUP0=rand
    
     playfield:
     ................................
     ................................
     ................................
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
     XXXXXXXXX..............XXXXXXXXX
    end
    
     drawscreen
    
     player0y=player0y+1
    
     if player0y>90 then player0y=200 : player0x=200
     if joy0down then reboot
    
     goto fall
    

  3. I thought that this demo might be able too help others wanting to do a small dungeon exploration demo. So I figured we would learn together!

     

    I'm basing this on the Hunt the Wumpus mechanics. You try too find the dragon lurking somewhere in the dark while avoiding bottomless pits and other things.

     

    I'm hoping this turns out to be helpful for you! But I reserve this particular game so if you are basing your game on it please change it enough too look different. I will do updates as I figure out some clever solutions so in the end we'll end up with a "hunt the wumpus" engine that anyone can use!

     

    --------------------------------

    Controls

     

    Press the button on the titlescreen to go too the class selection screen.

     

    Left, up and down shows you the classes at the titlescreen so you can see which guy you want to be.

    left, up or down and pressing the button selects the class and starts the game.

     

    Left, right, up and down moves your hero in the dungeon.

     

    When you fall down the pit press down to restart the game.

    --------------------------------

     

    So far I have:

    Titlescreen

    Class selection, choose between a Barbarian, Thief or Mage. I'm going to add another class later.

     

    The dungeon. Thanks too RandomTerrain for teaching me how to use pfpixel on/off. Tiles you've been on are lit, the ones you haven't been to are unlit.

     

    Hero movement

     

    --------------------------------

    WIP

    Some kind of clue when you are next too the dragon or the pits.

     

    Attacking the dragon. (You'll have 2 tries to kill it.

     

    Working timer

    --------------------------------

     

    DOWNLOAD - DnD0.3.bas


  4. I have another question. I could use a hint for how to calculate if player1 is next to player0 and if less then 5x/y a sound is played.

     

    I've tried all I could think of, so I believe I'm in the need to learn something completely new to handle this.

     

    This is as far as my basic understanding of these things go and it's no good:

    if player0x=player1x5 then o=10

     

    So in short, how do I go about checking for player1x/y if it's next too player0x/y?


  5. That's neat! It's almost what I was going for, I'm trying to make it so that the pfpixels player0 has been on stays red.

     

    Looking at the code, I notice some new things that I'd like to ask about in order to better grasp how this works.

    Is the playfield required to be inverted for it to work?

     

    And this code I don't quite get. I understant the idea that it makes the pfpixel that player0 is currently on turn on. But how are the numbers determined and how come they are divided by 4 or 8? Is it due too the player moving 8 pixels up and down and 4 right and left?

    _PF_LR = (player0x-15)/4
    _PF_UD = (player0y/8)-1


  6. Okay, thanks to you Random Terrain I'm much closer to getting it to work now! =D
    Now I can atleast get pfpixels to get turned on and off, a bit random but stil. Sometimes I get 3 pfpixels next to eachothers, sometimes 5 or so, sometimes a complete line. What might be the cause do you think? Did I place something wrong?

     drawscreen
    
     if  joy0up then pfpixel _P0_L_R _P0_U_D off
    
     drawscreen
     pfpixel _P0_L_R _P0_U_D flip
     drawscreen
     pfpixel _P0_L_R _P0_U_D flip
    
       if !joy0up then _Bit1{1} = 0 : goto __Skip_Fire
    
       if _Bit1{1}  then goto __Skip_Fire
    
       _Bit1{1} = 1
    
     _P0_U_D=_P0_U_D-8.00
    
    
    __Skip_Fire
    
    
       if !joy0down then _Bit2{1} = 0 : goto __Skip_Fire2
    
       if _Bit2{1}  then goto __Skip_Fire2
    
       _Bit2{1} = 1
    
     _P0_U_D=_P0_U_D+8.00
    
    
    __Skip_Fire2
    
    
       if !joy0left then _Bit3{1} = 0 : goto __Skip_Fire3
    
       if _Bit3{1}  then goto __Skip_Fire3
    
       _Bit3{1} = 1
    
     _P0_L_R=_P0_L_R-8.00
    
    
    __Skip_Fire3
    
    
    
       if !joy0right then _Bit4{1} = 0 : goto __Skip_Fire4
    
       if _Bit4{1}  then goto __Skip_Fire4
    
       _Bit4{1} = 1
    
     _P0_L_R=_P0_L_R+8.00
    
    __Skip_Fire4
    
    SKIP
    
      goto main
    
    

    SOURCE - D&D Demo.bas


  7. Slowly but surely I'm beginning too understand I think while tinkering like Dr. Frankenstein, creating all kinds of horrors that wasn't meant to be.

    I have 1 major issue I can't get to work at all. I can't do a dimer for player0 x,y.

     

    I tried doing dim herox=x and dim heroy=y but I either end up with an error or the character won't move. What is the proper way of doing this with player?


  8. Hmm...I'm getting something now. Sometimes when I press joy0up 2 vertical bars appear left and right of the playfield. Atleast it's something happening. Now if I can only figure out how to get it at the locations I want.


  9. Hm, that was helpful, but still a bit confusing. From what I understand I need a dim for my player0.

     

    That would be :

    dim herox = e
    dim heroy = f

     

    And when the hero moves something like this?

     

    if !joy0up then _Bit1{1} = 0 : goto __Skip_Fire

    if _Bit1{1} then goto __Skip_Fire

    _Bit1{1} = 1

    player0y=player0y-7 : pfpixel player0x player0y on

    __Skip_Fire

     

     

    Am I getting warm? =)


  10. I have a question about the pfpixel on/off. I have a playfield where I want the pfpixels 12-21horizontal and 2-9 vertical to be turned on if player0 is on the same place. The player is 8x7 so the sprite fits perfectly in 1x2 pfpixels. How do I do a check too see if player0 is on the pfpixels?

     

    I'm guessing something like this won't work?

     if player0x = pfpixel 3 12 then pfpixel 3 12  on
    
    

  11. By the way, I've hit a snag, I loaded up the sourcecode today to do a small update, upon compiling I got a syntax error which is weird, I didn't do any changes yet, and it worked fine when I made the game. What gives?

     

    What is the meaning of this error message?

    DASM V2.20.07, Macro Assembler (C)1988-2003
    default.bas.asm (2103): error: Illegal character ':'.
    char = ':' 58 (-1: 49)
    default.bas.asm (2103): error: Syntax Error 'if f = 20 then player1:'.
          bytes of ROM space left
    Unrecoverable error(s) in pass, aborting assembly!
    Complete.
    Errors were encountered during assembly.
    
×
×
  • Create New...