Weekly Qbasic and Qb64 Lesson Topics
April 16, 2024, 10:28:57 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Duke Nukem Game Rewrite.

Pages: 1 2 [3]
  Print  
Author Topic: Duke Nukem Game Rewrite.  (Read 2120 times)
none
Guest
« Reply #30 on: June 16, 2011, 08:22:56 am »


    not much more progress as yet. The editor now shows the entire sprite sheet by using the keys "1 or 2 or 3" to select the beginning, middle or end of the sprite sheet. As yet i havent figured out the formula to show the correctly selected tile according to the entire sheet dimensions. However you can select and paste tiles anywhere from the sheet to the map window.
Code:
REM
DEFLNG A-Z


_TITLE "DukeNukem Editor"

Video& = _NEWIMAGE(800, 600, 32)
Tiles& = _LOADIMAGE("DN1TileSheet.png", 32)

SCREEN Video&
_FULLSCREEN
_MOUSESHOW

DIM SHARED mx%, my%, mbl%, mbr%

Grey& = _RGB32(192, 192, 192)
Pink& = _RGB32(255, 105, 180)
LWhite& = _RGB32(255, 250, 250)
Yellow& = _RGB32(255, 255, 0)
Gold& = _RGB32(255, 215, 0)

TTab = 1

GOSUB Box
GOSUB Grid
GOSUB TileTab
GOSUB Tiles

DO
  _LIMIT 30
  MousePoll
  GOSUB TileTab
  GOSUB Tiles
  IF mx% >= 8 AND mx% <= 407 THEN
    IF my% >= 8 AND my% <= 407 THEN
      'the paste window
      px% = mx% - 7: py% = my% - 7
      pxx% = px% \ 16: pyy% = py% \ 16
      IF pxx% > 24 THEN pxx% = 24
      IF pyy% > 24 THEN pyy% = 24
      IF mbl% = -1 THEN
        Place% = 2
        'LINE (8 + (pxx% * 16), 8 + (pyy% * 16))-(8 + (pxx% * 16) + 15, 8 + (pyy% * 16) + 15), Gold&, B
        _PUTIMAGE (8 + (pxx% * 16), 8 + (pyy% * 16))-(8 + (pxx% * 16) + 15, 8 + (pyy% * 16) + 15), Tiles&, Video&, (Plus% + xxxx%, yyyy%)-(Plus% + xxxx% + 15, yyyy% + 15)
      END IF
    END IF
  END IF
  LOCATE 8, 80: PRINT "PASTE"
  LOCATE 9, 80: PRINT pxx% + 1
  LOCATE 10, 80: PRINT pyy% + 1

  IF mx% >= 440 AND mx% <= 600 THEN
    IF my% >= 8 AND my% <= 248 THEN
      'the select window
      x% = mx% - 440: y% = my% - 8
      xx% = x% \ 16: yy% = y% \ 16
      IF xx% > 9 THEN xx% = 9
      IF yy% > 14 THEN yy% = 14
      IF mbl% = -1 THEN
        Place% = 1
        GOSUB Tiles
        xxxx% = xx% * 16: yyyy% = yy% * 16: Plus% = 160 * (TTab - 1): LOCATE 30, 1: PRINT Plus% + xxxx%
        'LINE (108, 450)-(123, 465), Gold&, B
        _PUTIMAGE (108, 450)-(123, 465), Tiles&, Video&, (Plus% + xxxx%, yyyy%)-(Plus% + xxxx% + 15, yyyy% + 15)
        LINE (440 + xxxx%, 8 + yyyy%)-(440 + (xxxx% + 15), 8 + (yyyy% + 15)), Gold&, B
        Tile% = (yy% * 10) + xx%
        LOCATE 4, 80: PRINT "Tile"
        LOCATE 5, 80: PRINT Tile% + 1
      END IF
    END IF
  END IF
  LOCATE 1, 80: PRINT "SELECT"
  LOCATE 2, 80: PRINT xx%
  LOCATE 3, 80: PRINT yy%
  _DISPLAY
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM

Box:
LINE (0, 0)-(415, 415), Grey&, BF
LINE (8, 8)-(407, 407), LWhite&, BF
LINE (432, 0)-(608, 256), Grey&, BF
LINE (440, 8)-(599, 247), LWhite&, BF
LINE (104, 446)-(127, 469), Grey&, BF
RETURN

Grid:
wide = 24: deep = 24
x1 = 8: x2 = (16 * wide) + x1: y1 = 8: y2 = (16 * deep) + y1

FOR x = x1 TO x2 STEP 16
  FOR y = y1 TO y2 STEP 16
    LINE (x, y)-(x + 15, y + 15), Pink&, B
  NEXT y
NEXT x
RETURN

Tiles:
SELECT CASE TTab
  CASE 1
    _PUTIMAGE (440, 8)-(599, 247), Tiles&, Video&, (0, 0)-(159, 239)
  CASE 2
    _PUTIMAGE (440, 8)-(599, 247), Tiles&, Video&, (160, 0)-(319, 239)
  CASE 3
    _PUTIMAGE (440, 8)-(599, 247), Tiles&, Video&, (320, 0)-(479, 239)
END SELECT
RETURN

TileTab:
IF _KEYDOWN(49) THEN
  TTab = 1
  PRINT "ONE"
  GOSUB Tiles
END IF
IF _KEYDOWN(50) THEN
  TTab = 2
  PRINT "TWO"
  GOSUB Tiles
END IF
IF _KEYDOWN(51) THEN
  TTab = 3
  PRINT "THREE"
  GOSUB Tiles
END IF
LOCATE 20, 60: PRINT "Tile Tab="; TTab
RETURN

SUB MousePoll ()
DO WHILE _MOUSEINPUT
  mx% = _MOUSEX: my% = _MOUSEY: mbl% = _MOUSEBUTTON(1): mbr% = _MOUSEBUTTON(2)
LOOP
END SUB
« Last Edit: September 08, 2011, 11:20:50 pm by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #31 on: September 06, 2011, 11:37:58 pm »

Just a note, I stickeyd this so it stays, up at top where it can be found easy.
from Garry
Well this is a tuff one, Unseen what I have done is unstickyd this thread, because
for one no one has posted in it for so long, because both you and oldoslover, ahve posted code here, and I have no clue as to who "owns" the code, anyway if there is no activity it will work it's way down, eventually,...As far as I am concerned anyone can copy and use any of this code anyway, any where they want,...according to Oldoslover he owns the code, and dose not want it posted on any other site,...I don't believe Unseen feels the same,..Huh So anyone wanting to copy any of it best ask them first. From Garry
Report Spam   Logged


Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy