April 22, 2025, 09:25:09 pm
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
Forever
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.
Weekly Qbasic and Qb64 Lesson Topics
>
Forum
>
General Category
>
General QB64 Forum
>
Duke Nukem Game Rewrite.
Pages: [
1
]
2
3
« previous
next »
Print
Author
Topic: Duke Nukem Game Rewrite. (Read 2353 times)
none
Guest
Duke Nukem Game Rewrite.
«
on:
May 31, 2011, 08:25:22 am »
«
Last Edit: September 08, 2011, 11:06:54 pm by GarrisonRicketson
»
Report Spam
Logged
nonexistant
Guest
Re: Duke Nukem Game Rewrite.
«
Reply #1
on:
May 31, 2011, 08:28:25 am »
Unseen , looking over your code i came across this and would like an explanation please.
Quote
DukeAnimTimer# = TIMER(.001) '// Animation timer
DukeAnimTime# = .07 '// Time between animation frames
My question is how many frames per second does this account to?
«
Last Edit: September 08, 2011, 11:08:04 pm by GarrisonRicketson
»
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #2
on:
May 31, 2011, 08:51:51 am »
Hey OlDosLover,
It should take it 0.35 seconds to play the 5 frame animation loop, so about 14-15 animation frames per second.
I am re-writing the code at the moment to use a generic TYPE for sprites and think we should just send the code back and forth for now until YOU decide how you want to do things and who you want to them, I would love for Garry, MrWhy and DustieBear to be involved. I only made the code cause i was bored and as a suggestion of how to do it.
John
Report Spam
Logged
nonexistant person
Guest
Re: Duke Nukem Game Rewrite.
«
Reply #3
on:
May 31, 2011, 09:04:19 am »
Thanks for the explanation. I expect 14- 15 will be more than fast enough. The methods that you have chosen to represent the structure of the game are a little different to how i think. I see nothing wrong with what you have done , im just adjusting to it.
I agree that types should be used. I was looking over your code to detect keypresses and thought _keydown would be a better option. Maybe we poll the keyboard and do our own updated dim to represent keys down or up.
Im working on an editor to build the duke world at the moment.
«
Last Edit: September 08, 2011, 11:09:11 pm by GarrisonRicketson
»
Report Spam
Logged
none
Guest
Re: Duke Nukem Game Rewrite.
«
Reply #4
on:
May 31, 2011, 11:54:45 am »
Hi all,
On discussion with Unseen about how we would handle the keyboard routine , we pondered over the existing GDK idea of a type and dim.
Quote
TYPE KeyBoardState
Left AS LONG
Right AS LONG
Down AS LONG
Up AS LONG
CTRL AS LONG
SHIFT AS LONG
ALT AS LONG
SPACE AS LONG
ENTER AS LONG
ESC AS LONG
Num1 AS LONG
Num2 AS LONG
Num3 AS LONG
Num4 AS LONG
Num5 AS LONG
Num6 AS LONG
Num7 AS LONG
Num8 AS LONG
Num9 AS LONG
Num0 AS LONG
PLUS AS LONG
MINUS AS LONG
BACKSPACE AS LONG
TAB AS LONG
A AS LONG
B AS LONG
C AS LONG
D AS LONG
E AS LONG
F AS LONG
G AS LONG
H AS LONG
I AS LONG
J AS LONG
K AS LONG
L AS LONG
M AS LONG
N AS LONG
O AS LONG
P AS LONG
Q AS LONG
R AS LONG
S AS LONG
T AS LONG
U AS LONG
V AS LONG
W AS LONG
X AS LONG
Y AS LONG
Z AS LONG
END TYPE
SUB GDK_Keyboard_GetState (KeyboardRef AS KeyBoardState)
FOR x% = 1 TO 88 'read each key scancode from array
IF x% = 1 THEN KeyboardRef.ESC = scankey%(x%)
IF x% = 2 THEN KeyboardRef.Num1 = scankey%(x%)
IF x% = 3 THEN KeyboardRef.Num2 = scankey%(x%)
IF x% = 4 THEN KeyboardRef.Num3 = scankey%(x%)
IF x% = 5 THEN KeyboardRef.Num4 = scankey%(x%)
IF x% = 6 THEN KeyboardRef.Num5 = scankey%(x%)
IF x% = 7 THEN KeyboardRef.Num6 = scankey%(x%)
IF x% = 8 THEN KeyboardRef.Num7 = scankey%(x%)
IF x% = 9 THEN KeyboardRef.Num8 = scankey%(x%)
IF x% = 10 THEN KeyboardRef.Num9 = scankey%(x%)
IF x% = 11 THEN KeyboardRef.Num0 = scankey%(x%)
IF x% = 12 THEN KeyboardRef.PLUS = scankey%(x%)
IF x% = 13 THEN KeyboardRef.MINUS = scankey%(x%)
IF x% = 14 THEN KeyboardRef.BACKSPACE = scankey%(x%)
IF x% = 15 THEN KeyboardRef.TAB = scankey%(x%)
IF x% = 30 THEN KeyboardRef.A = scankey%(x%)
IF x% = 48 THEN KeyboardRef.B = scankey%(x%)
IF x% = 46 THEN KeyboardRef.C = scankey%(x%)
IF x% = 32 THEN KeyboardRef.D = scankey%(x%)
IF x% = 18 THEN KeyboardRef.E = scankey%(x%)
IF x% = 33 THEN KeyboardRef.F = scankey%(x%)
IF x% = 34 THEN KeyboardRef.G = scankey%(x%)
IF x% = 35 THEN KeyboardRef.H = scankey%(x%)
IF x% = 23 THEN KeyboardRef.I = scankey%(x%)
IF x% = 36 THEN KeyboardRef.J = scankey%(x%)
IF x% = 37 THEN KeyboardRef.K = scankey%(x%)
IF x% = 38 THEN KeyboardRef.L = scankey%(x%)
IF x% = 50 THEN KeyboardRef.M = scankey%(x%)
IF x% = 49 THEN KeyboardRef.N = scankey%(x%)
IF x% = 24 THEN KeyboardRef.O = scankey%(x%)
IF x% = 25 THEN KeyboardRef.P = scankey%(x%)
IF x% = 16 THEN KeyboardRef.Q = scankey%(x%)
IF x% = 19 THEN KeyboardRef.R = scankey%(x%)
IF x% = 31 THEN KeyboardRef.S = scankey%(x%)
IF x% = 20 THEN KeyboardRef.T = scankey%(x%)
IF x% = 22 THEN KeyboardRef.U = scankey%(x%)
IF x% = 47 THEN KeyboardRef.V = scankey%(x%)
IF x% = 17 THEN KeyboardRef.W = scankey%(x%)
IF x% = 45 THEN KeyboardRef.X = scankey%(x%)
IF x% = 21 THEN KeyboardRef.Y = scankey%(x%)
IF x% = 44 THEN KeyboardRef.Z = scankey%(x%)
IF x% = 72 THEN KeyboardRef.Up = scankey%(x%)
IF x% = 75 THEN KeyboardRef.Left = scankey%(x%)
IF x% = 77 THEN KeyboardRef.Right = scankey%(x%)
IF x% = 80 THEN KeyboardRef.Down = scankey%(x%)
IF x% = 28 THEN KeyboardRef.ENTER = scankey%(x%)
IF x% = 57 THEN KeyboardRef.SPACE = scankey%(x%)
IF x% = 29 THEN KeyboardRef.CTRL = scankey%(x%)
IF x% = 56 THEN KeyboardRef.ALT = scankey%(x%)
IF x% = 42 THEN KeyboardRef.SHIFT = scankey%(x%)
NEXT
END SUB
FUNCTION scankey% (scancode%)
STATIC Ready%, keyflags%()
IF NOT Ready% THEN REDIM keyflags%(0 TO 127): Ready% = -1 'the keyboard states
i% = INP(&H60)
IF (i% AND 128) THEN keyflags%(i% XOR 128) = 0
IF (i% AND 128) = 0 THEN keyflags%(i%) = -1
WHILE INKEY$ <> "": WEND
scankey% = keyflags%(scancode%)
END FUNCTION
I disclosed that i believe that Galleon's efforts with _KEYDOWN were suppose to be faster. He agreed in the sense that if its faster then we would go with that idea. And so this routine was born. Any comments?
Code:
REM KeyBoard1.bas
DEFLNG A-Z
CONST True = -1, False = 0
TYPE KeyBoardState
Left AS LONG
Right AS LONG
Down AS LONG
Up AS LONG
CTRL AS LONG
SHIFT AS LONG
ALT AS LONG
SPACE AS LONG
ENTER AS LONG
ESC AS LONG
END TYPE
DIM KeyRef AS KeyBoardState
'------------------------------------------------------------------------------------------------------------------------------------
SCREEN 12
DO
_LIMIT 30
KeyState KeyRef
LOCATE 9, 1: PRINT "Left", "Up", "Down", "Right"
LOCATE 10, 1
PRINT KeyRef.Left, KeyRef.Up, KeyRef.Down, KeyRef.Right
LOCATE 12, 1: PRINT "CTRL", "ALT", "Shift", "Space"
LOCATE 13, 1
PRINT KeyRef.CTRL, KeyRef.ALT, KeyRef.SHIFT, KeyRef.SPACE
_DISPLAY
LOOP UNTIL Done = 1
SLEEP
SYSTEM
'------------------------------------------------------------------------------------------------------------------------------------
SUB KeyState (KeyRef AS KeyBoardState)
KeyRef.ESC = _KEYDOWN(27)
KeyRef.SPACE = _KEYDOWN(32)
KeyRef.Left = _KEYDOWN(19200)
KeyRef.Right = _KEYDOWN(19712)
KeyRef.Down = _KEYDOWN(20480)
KeyRef.Up = _KEYDOWN(18432)
IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN KeyRef.CTRL = True ELSE KeyRef.CTRL = False
IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN KeyRef.ALT = True ELSE KeyRef.ALT = False
IF _KEYDOWN(100303) OR _KEYDOWN(100304) THEN KeyRef.SHIFT = True ELSE KeyRef.SHIFT = False
KeyRef.ENTER = _KEYDOWN(13)
END SUB
Compared to the existing key routine this seems it may be faster on paper. This routine can be expanded to cover more keys later. At the moment this routine treats the separate R + L shift , alt and ctrl keys as only one of each. The idea is in a game we only interested if a key is down or up and not so much which of the two keys it is. Although this can be changed later.
«
Last Edit: September 08, 2011, 11:10:31 pm by GarrisonRicketson
»
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #5
on:
May 31, 2011, 01:05:59 pm »
How much animation do you want? I reckon we should have jumping and climbing ladders as a minimum.
http://www.spriters-resource.com/pc_computer/dukenukem2/
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #6
on:
May 31, 2011, 02:29:53 pm »
Are you wanting to use all the animations for Duke? That would mean a hell of a time figuring out collisions based on tiles to determine what animation etc...Adding slopes to the terrain will make making it very hard.
Also, how will levels be? Single fixed pages or scrolling? If scrolling, then is it just on the X axis? or both X and Y?
John
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #7
on:
May 31, 2011, 03:28:54 pm »
Ok cool.
I need you to finish the keyboard input and merge that with the code we have allready. What do you need from me?
Here's what i have done so far, just loading the tile loacations into an array. It accounts for the lump on the bottom right of the tilesheet and ignores it. That was a little head scratcher in it's self.
Put this in your DukeNukem folder...
http://dl.dropbox.com/u/8822351/TileSheet.png
Code:
'// Animated Duke Nukem
'// Set up a screen for animation
SCREEN _NEWIMAGE(800, 600, 32)
CHDIR "dukenukem\" '// Maybe we should all make this folder?
'// The Rect TYPE has two main uses, the first is for sprite animation, the second for bounding
'// RECT collision detection but it alos used for tilesheets! Useful Eh?
TYPE Rect
X AS INTEGER
Y AS INTEGER
Width AS INTEGER
Height AS INTEGER
END TYPE
'// The Sprite TYPE contains variables common to all sprites
TYPE Sprite
X AS INTEGER
Y AS INTEGER
AnimFrame AS INTEGER
AnimTime AS DOUBLE
IsMoving AS INTEGER
Direction AS INTEGER
Exists AS INTEGER
END TYPE
DIM DukeImage AS LONG '// Duke character sprite
'// TO BE RE_CODED TO FIT NEW ANIMATION!!!
DIM SHARED DukeFrame(1 TO 10) AS Rect '// Hold animation frame co-ordinates
DIM Duke AS Sprite, DukeRect AS Rect
DukeImage = _LOADIMAGE("Duke.png", 32) '// Load the image
_CLEARCOLOR _RGB32(255, 0, 255), DukeImage '// Set pink as the transparent colour
'// Load the animation RECTs into memory.
'// The duke image has 10 frames, equally spaced on a single line, so this is easy.
FrameCount% = 1
FOR X% = 0 TO _WIDTH(DukeImage) - (_WIDTH(DukeImage) / 10) STEP (_WIDTH(DukeImage) / 10)
DukeFrame(FrameCount%).X = X%
DukeFrame(FrameCount%).Height = _HEIGHT(DukeImage)
DukeFrame(FrameCount%).Width = _WIDTH(DukeImage) / 10
FrameCount% = FrameCount% + 1
NEXT
'// END OF NEEDED RE_CODE
'// TileSheet loading, sheet has 30 columns 15 rows = 450 tiles (but some are empty)
'// After tile 300, tiles are only 20 columns wide - this acounts for that.
TileSheet& = _LOADIMAGE("Tilesheet.png")
DIM Tile(1 TO 400) AS Rect
X% = 0
Y% = 0
XStep% = _WIDTH(TileSheet&) / 30
YStep% = _HEIGHT(TileSheet&) / 15
FOR i% = 1 TO 400
Tile(i%).X = X%
Tile(i%).Y = Y%
Tile(i%).Width = XStep%
Tile(i%).Height = YStep%
X% = X% + XStep%
IF i% > 300 THEN
IF X% >= _WIDTH(TileSheet&) - (XStep% * 11) THEN
X% = 0
Y% = Y% + YStep%
END IF
ELSE
IF X% >= _WIDTH(TileSheet&) - XStep% THEN
X% = 0
Y% = Y% + YStep%
END IF
END IF
'// DEBUG CODE _ REMOVE FROM FINAL
_PUTIMAGE (X%, Y%)-(X% + XStep%, Y% + YStep%), TileSheet&, , (X%, Y%)-(X% + XStep%, Y% + YStep%)
NEXT
_DISPLAY
SLEEP
'// Duke Initial Position Animation and direction Variables
Duke.X = 0
Duke.Y = 500
Duke.AnimFrame = 1 '// Current Animation Frame
Duke.Direction = 1 '// 1 = Right, 2 = left
Duke.IsMoving% = 0
Duke.AnimTime = .07 '// Time between animation frames
DukeRect.Height = _HEIGHT(DukeImage)
DukeRect.Width = _WIDTH(DukeImage) / 10
DukeAnimTimer# = TIMER(.001) '// Animation timer
DO
_LIMIT 30
CLS
'// Duke Collision RECT
DukeRect.X = DukeX%
DukeRect.Y = DukeY%
'// Duke Movement, Collisions and animation control...
IF Duke.Direction = 1 THEN
IF Duke.AnimFrame >= 5 THEN
Duke.AnimFrame = 1
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime# THEN
IF Duke.AnimFrame < 5 THEN Duke.AnimFrame = Duke.AnimFrame + 1 ELSE Duke.AnimFrame = 1
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X + DukeRect.Width < 800 THEN Duke.X = Duke.X + 3
END IF
END IF
END IF
ELSEIF Duke.Direction = 2 THEN
IF Duke.AnimFrame < 5 OR Duke.AnimFrame = 10 THEN
Duke.AnimFrame = 6
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime THEN
IF Duke.AnimFrame < 10 THEN Duke.AnimFrame = Duke.AnimFrame + 1 ELSE Duke.AnimFrame = 6
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X > 0 THEN Duke.X = Duke.X - 3
END IF
END IF
END IF
END IF
'// Input - Keyboard
KB$ = INKEY$
SELECT CASE KB$
CASE CHR$(0) + CHR$(75) '// LEFT ARROW
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing???
ELSE
Duke.IsMoving = -1
Duke.Direction = 2
Duke.AnimFrame = 6
END IF
CASE CHR$(0) + CHR$(77) '// RIGHT ARROW
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing???
ELSE
Duke.IsMoving = -1
Duke.Direction = 1
Duke.AnimFrame = 1
END IF
END SELECT
'// Drawing Duke
_PUTIMAGE (Duke.X, Duke.Y)-(Duke.X + DukeRect.Width, Duke.Y + DukeRect.Height), DukeImage, , (DukeFrame(Duke.AnimFrame).X, 0)-(DukeFrame(Duke.AnimFrame).X + DukeFrame(Duke.AnimFrame).Width, _HEIGHT(DukeImage))
_DISPLAY
LOOP
'// Determines if any part of two rectangles intersect. returns -1 for true, 0 for false
FUNCTION RECT_Intersect (RECTRef1 AS Rect, RECTRef2 AS Rect)
IF RECTRef1.X <= RECTRef2.X + RECTRef2.Width THEN
IF RECTRef1.X + RECTRef1.Width >= RECTRef2.X THEN
IF RECTRef1.Y <= RECTRef2.Y + RECTRef2.Height THEN
IF RECTRef1.Y + RECTRef1.Height >= RECTRef2.Y THEN
RECT_Intersect = -1
END IF
END IF
END IF
ELSE
RECT_Intersect = 0
END IF
END FUNCTION
It pauses the code after drawing the tiles (i only got it to draw them for debugging), but i just want you to look over the method to see if you have a better way.
John
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #8
on:
May 31, 2011, 04:10:49 pm »
Duke 1, I need you to send me the version of the sprite sheet you will be using. Please only include on it the frames that you want in the final game.
As for movement, I understand and it SHOULD be easy to change.
John
p.s, I did put a note on the code that it needs re-coding to fit the new animation.
And where's me keyboard code? I need's it for the intor screen.
Also, how may columns/rows will be in a level (i.e visible on screen at any one time)? How are you saving the levels in your level builder?
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #9
on:
May 31, 2011, 04:49:41 pm »
Got the code for the Keyboard and ported it, works like a charm. Nice one OlDosLover.
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #10
on:
May 31, 2011, 05:59:39 pm »
Here's all i can do for today, tired now...
http://dl.dropbox.com/u/8822351/DukeFiles.rar
And here's the code i have so far, a few of the DUKE frames may need a tweak one pixel left/right but it's getting there.
Code:
'// Animated Duke Nukem
'// Set up a screen for animation
SCREEN _NEWIMAGE(800, 600, 32)
_TITLE "DUKE NUKEM"
_SCREENMOVE 0, 0
CHDIR "dukenukem\" '// FOLDER CONATIANING GAME CONTENT
'// INTRO SCREEN AND MAIN MENU
'// GAME MUSIC???
Logo& = _LOADIMAGE("Splash.png")
Logo2& = _LOADIMAGE("Splash2.png")
_CLEARCOLOR _RGB(255, 0, 255), Logo&
_CLEARCOLOR _RGB(255, 0, 255), Logo2&
FOR y% = 600 TO 100 STEP -2
_LIMIT 60
CLS
_PUTIMAGE (150, y%)-(650, y% + 400), Logo&
_PUTIMAGE (150, 520 - y%)-(650, (520 - y%) + 112), Logo2&
_DISPLAY
NEXT
'// Main Menu
SLEEP
'// The Rect TYPE has two main uses, the first is for sprite animation, the second for bounding
'// RECT collision detection but it alos used for tilesheets! Useful Eh?
TYPE Rect
X AS INTEGER
Y AS INTEGER
Width AS INTEGER
Height AS INTEGER
END TYPE
'// The Sprite TYPE contains variables common to all sprites
TYPE Sprite
X AS INTEGER
Y AS INTEGER
AnimFrame AS INTEGER
AnimTime AS DOUBLE
IsMoving AS INTEGER
Direction AS INTEGER
Exists AS INTEGER
END TYPE
DIM DukeImage AS LONG '// Duke character sprite
'// TO BE RE_CODED TO FIT NEW ANIMATION!!!
DIM SHARED DukeFrame(1 TO 14) AS Rect '// Hold animation frame co-ordinates
DIM Duke AS Sprite, DukeRect AS Rect
DukeImage = _LOADIMAGE("Duke.png", 32) '// Load the image
_CLEARCOLOR _RGB32(255, 0, 255), DukeImage '// Set pink as the transparent colour
'// Load the animation RECTs into memory.
'// The duke image has 14 frames, equally spaced on a single line, so this is easy.
FrameCount% = 1
FOR X% = 0 TO _WIDTH(DukeImage) - (_WIDTH(DukeImage) / 14) STEP (_WIDTH(DukeImage) / 14)
DukeFrame(FrameCount%).X = X%
DukeFrame(FrameCount%).Height = _HEIGHT(DukeImage)
DukeFrame(FrameCount%).Width = _WIDTH(DukeImage) / 14
FrameCount% = FrameCount% + 1
NEXT
'// END OF NEEDED RE_CODE
'// TileSheet loading, sheet has 30 columns 15 rows = 450 tiles (but some are empty)
'// After tile 300, tiles are only 20 columns wide - this acounts for that.
TileSheet& = _LOADIMAGE("Tilesheet.png")
DIM Tile(1 TO 400) AS Rect
X% = 0
y% = 0
XStep% = _WIDTH(TileSheet&) / 30
YStep% = _HEIGHT(TileSheet&) / 15
FOR i% = 1 TO 400
Tile(i%).X = X%
Tile(i%).Y = y%
Tile(i%).Width = XStep%
Tile(i%).Height = YStep%
X% = X% + XStep%
IF i% > 300 THEN
IF X% >= _WIDTH(TileSheet&) - (XStep% * 11) THEN
X% = 0
y% = y% + YStep%
END IF
ELSE
IF X% >= _WIDTH(TileSheet&) - XStep% THEN
X% = 0
y% = y% + YStep%
END IF
END IF
NEXT
'// Duke Initial Position Animation and direction Variables
Duke.X = 0
Duke.Y = 500
Duke.AnimFrame = 1 '// Current Animation Frame
Duke.Direction = 1 '// 1 = Right, 2 = left
Duke.IsMoving% = 0
Duke.AnimTime = .07 '// Time between animation frames
DukeRect.Height = _HEIGHT(DukeImage)
DukeRect.Width = _WIDTH(DukeImage) / 10
DukeAnimTimer# = TIMER(.001) '// Animation timer
DIM KB(2) AS KeyBoardState
DO
_LIMIT 30
CLS
'// Duke Collision RECT
DukeRect.X = DukeX%
DukeRect.Y = DukeY%
'// Duke Movement, Collisions and animation control...
IF Duke.Direction = 1 THEN
IF Duke.AnimFrame >= 6 THEN
Duke.AnimFrame = 1
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime# THEN
IF Duke.AnimFrame < 6 THEN Duke.AnimFrame = Duke.AnimFrame + 1 ELSE Duke.AnimFrame = 2
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X + DukeRect.Width < 800 THEN Duke.X = Duke.X + 3
END IF
ELSE
Duke.AnimFrame = 1
END IF
END IF
ELSEIF Duke.Direction = 2 THEN '// Left
IF Duke.AnimFrame <= 8 THEN
Duke.AnimFrame = 14
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime THEN
IF Duke.AnimFrame > 8 THEN Duke.AnimFrame = Duke.AnimFrame - 1 ELSE Duke.AnimFrame = 13
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X > 0 THEN Duke.X = Duke.X - 3
END IF
ELSE
Duke.AnimFrame = 14
END IF
END IF
END IF
'// Input - Keyboard
KeyState KB(0)
IF KB(0).Left AND NOT KB(0).Right THEN
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing???
ELSE
Duke.IsMoving = -1
Duke.Direction = 2
Duke.AnimFrame = 14
END IF
ELSEIF KB(0).Right AND NOT KB(0).Left THEN
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing???
ELSE
Duke.IsMoving = -1
Duke.Direction = 1
Duke.AnimFrame = 1
END IF
END IF
KB(1) = KB(0) '// Copy the keyboard state for comparisons
'// Drawing Duke
_PUTIMAGE (Duke.X, Duke.Y)-(Duke.X + DukeRect.Width, Duke.Y + DukeRect.Height), DukeImage, , (DukeFrame(Duke.AnimFrame).X, 0)-(DukeFrame(Duke.AnimFrame).X + DukeFrame(Duke.AnimFrame).Width, _HEIGHT(DukeImage))
_DISPLAY
LOOP
'// Determines if any part of two rectangles intersect. returns -1 for true, 0 for false
FUNCTION RECT_Intersect (RECTRef1 AS Rect, RECTRef2 AS Rect)
IF RECTRef1.X <= RECTRef2.X + RECTRef2.Width THEN
IF RECTRef1.X + RECTRef1.Width >= RECTRef2.X THEN
IF RECTRef1.Y <= RECTRef2.Y + RECTRef2.Height THEN
IF RECTRef1.Y + RECTRef1.Height >= RECTRef2.Y THEN
RECT_Intersect = -1
END IF
END IF
END IF
ELSE
RECT_Intersect = 0
END IF
END FUNCTION
TYPE KeyBoardState
Left AS LONG
Right AS LONG
Down AS LONG
Up AS LONG
CTRL AS LONG
SHIFT AS LONG
ALT AS LONG
SPACE AS LONG
ENTER AS LONG
ESC AS LONG
END TYPE
SUB KeyState (KeyRef AS KeyBoardState)
KeyRef.ESC = _KEYDOWN(27)
KeyRef.SPACE = _KEYDOWN(32)
KeyRef.Left = _KEYDOWN(19200)
KeyRef.Right = _KEYDOWN(19712)
KeyRef.Down = _KEYDOWN(20480)
KeyRef.Up = _KEYDOWN(18432)
IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN KeyRef.CTRL = True ELSE KeyRef.CTRL = False
IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN KeyRef.ALT = True ELSE KeyRef.ALT = False
IF _KEYDOWN(100303) OR _KEYDOWN(100304) THEN KeyRef.SHIFT = True ELSE KeyRef.SHIFT = False
KeyRef.ENTER = _KEYDOWN(13)
END SUB
Let mw know if anything needs changing (press space to get passed the start screen).
All the best mate,
John
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #11
on:
June 01, 2011, 07:17:29 pm »
What are you using to make the editor? VQB02 would suit your need perfectly, here's a screen shot of my Wolf3D map maker i am making using it.
http://dl.dropbox.com/u/8822351/Wolf3dEditor.PNG
I made VQB02 REALLY simple to setup and use and it gives a semi-professinal finish. I am happy to walk you through it if you think it can be of any use.
As for the levels, i am with you on data staements and suggest a 40 columns * 15 rows setup (640*240) or something close, it's best to make it match a set number of frame widths.
Use 3 arrays to store the level data.
1 for the Level that has platforms.
1 for sprites, but make an array of a custom types containing each sprites basic variables, X,y, inital direction, speed, damage on impact, etc..
1 for the background
This should make it easy to flick through each one as needed and makes it easy to debug/understand.
Try this and let me know what you think...
Code:
'// Animated Duke Nukem
'// Set up a screen for animation
SCREEN _NEWIMAGE(640, 240, 32)
_TITLE "DUKE NUKEM"
_SCREENMOVE 0, 0
CHDIR "dukenukem\" '// FOLDER CONATIANING GAME CONTENT
'// INTRO SCREEN AND MAIN MENU
'// GAME MUSIC???
Logo& = _LOADIMAGE("Splash.png")
Logo2& = _LOADIMAGE("Splash2.png")
_CLEARCOLOR _RGB(255, 0, 255), Logo&
_CLEARCOLOR _RGB(255, 0, 255), Logo2&
FOR Y% = 240 TO 0 STEP -2
_LIMIT 60
CLS
_PUTIMAGE (120, Y%)-(520, Y% + 240), Logo&
_PUTIMAGE (120, 200 - Y%)-(520, (200 - Y%) + 40), Logo2&
_DISPLAY
NEXT
'// Main Menu
SLEEP
DIM DukeImage AS LONG '// Duke character sprite
DIM SHARED DukeFrame(1 TO 14) AS Rect '// Hold animation frame co-ordinates
DIM Duke AS Sprite, DukeRect AS Rect
DukeImage = _LOADIMAGE("Duke.png", 32) '// Load the image
_CLEARCOLOR _RGB32(255, 0, 255), DukeImage '// Set pink as the transparent colour
'// Load the animation RECTs into memory.
'// The duke image has 14 frames, equally spaced on a single line, so this is easy.
FOR X% = 0 TO _WIDTH(DukeImage) - (_WIDTH(DukeImage) / 14) STEP (_WIDTH(DukeImage) / 14)
FrameCount% = FrameCount% + 1
DukeFrame(FrameCount%).X = X%
DukeFrame(FrameCount%).Height = _HEIGHT(DukeImage)
DukeFrame(FrameCount%).Width = _WIDTH(DukeImage) / 14
NEXT
'// TileSheet loading, sheet has 30 columns 15 rows = 450 tiles (but some are empty)
'// After tile 300, tiles are only 20 columns wide - this acounts for that.
TileSheet& = _LOADIMAGE("Tilesheet.png")
DIM Tile(1 TO 400) AS Rect
X% = 0
Y% = 0
XStep% = _WIDTH(TileSheet&) / 30
YStep% = _HEIGHT(TileSheet&) / 15
FOR i% = 1 TO 400
Tile(i%).X = X%
Tile(i%).Y = Y%
Tile(i%).Width = XStep%
Tile(i%).Height = YStep%
X% = X% + XStep%
IF i% > 300 THEN
IF X% > _WIDTH(TileSheet&) - (XStep% * 11) THEN
X% = 0
Y% = Y% + YStep%
END IF
ELSE
IF X% > _WIDTH(TileSheet&) - XStep% THEN
X% = 0
Y% = Y% + YStep%
END IF
END IF
NEXT
'// LOAD THE LEVEL DATA
DIM Level(40, 15) AS INTEGER, BackGround(40, 15) AS INTEGER
FOR i% = 0 TO 14
FOR J% = 0 TO 39
READ TileBit%
Level(J%, i%) = TileBit%
NEXT
NEXT
FOR i% = 0 TO 14
FOR J% = 0 TO 39
READ TileBit%
BackGround(J%, i%) = TileBit%
NEXT
NEXT
'// Duke Initial Position Animation and direction Variables
Duke.X = 12
Duke.Y = 170
Duke.AnimFrame = 1 '// Current Animation Frame
Duke.Direction = 1 '// 1 = Right, 2 = left
Duke.IsMoving = 0
Duke.AnimTime = .07 '// Time between animation frames
Duke_IsJumping% = 0
DukeRect.Height = _HEIGHT(DukeImage)
DukeRect.Width = _WIDTH(DukeImage) / 14
DukeAnimTimer# = TIMER(.001) '// Animation timer
DIM KB(2) AS KeyBoardState
DO
_LIMIT 30
CLS
'// Duke Movement, Collisions and animation control...
'// First check to see if Duke is jumping, then faling, then assuming a collision with the background walk!
IF Duke.Direction = 1 THEN
IF Duke.AnimFrame >= 6 THEN
Duke.AnimFrame = 1
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime# THEN
IF Duke.AnimFrame < 6 THEN Duke.AnimFrame = Duke.AnimFrame + 1 ELSE Duke.AnimFrame = 2
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X + DukeRect.Width < 800 THEN Duke.X = Duke.X + 3
END IF
ELSE
Duke.AnimFrame = 1
END IF
END IF
ELSEIF Duke.Direction = 2 THEN '// Left
IF Duke.AnimFrame <= 8 THEN
Duke.AnimFrame = 14
Duke.IsMoving = 0 '// RESET Movement
ELSE
IF Duke.IsMoving THEN
IF TIMER(.001) - DukeAnimTimer# >= Duke.AnimTime THEN
IF Duke.AnimFrame > 8 THEN Duke.AnimFrame = Duke.AnimFrame - 1 ELSE Duke.AnimFrame = 13
DukeAnimTimer# = TIMER(.001) '// Animation timer
'// Move DUKE - check for collisions first though!!!
IF Duke.X > 0 THEN Duke.X = Duke.X - 3
END IF
ELSE
Duke.AnimFrame = 14
END IF
END IF
END IF
'// Duke Collision RECT
DukeRect.X = DukeX%
DukeRect.Y = DukeY%
'// Input - Keyboard
KeyState KB(0)
IF KB(0).Left AND NOT KB(0).Right THEN
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing ???
ELSE
Duke.IsMoving = -1
Duke.Direction = 2
Duke.AnimFrame = 14
END IF
ELSEIF KB(0).Right AND NOT KB(0).Left THEN
IF Duke.IsMoving THEN
'// Increase speed??? Do nothing???
ELSE
Duke.IsMoving = -1
Duke.Direction = 1
Duke.AnimFrame = 1
END IF
END IF
KB(1) = KB(0) '// Copy the keyboard state for comparisons
'// Drawing the background then the level
Y% = 0
FOR i% = 0 TO 14
X% = 0
FOR J% = 0 TO 39
IF BackGround(J%, i%) > 0 THEN
_PUTIMAGE (X%, Y%)-(X% + 15, Y% + 15), TileSheet&, , (Tile(BackGround(J%, i%)).X, Tile(BackGround(J%, i%)).Y)-(Tile(BackGround(J%, i%)).X + 15, Tile(BackGround(J%, i%)).Y + 15)
END IF
X% = X% + 16
NEXT
Y% = Y% + 16
NEXT
Y% = 0
FOR i% = 0 TO 14
X% = 0
FOR J% = 0 TO 39
IF Level(J%, i%) > 0 THEN
_PUTIMAGE (X%, Y%)-(X% + 15, Y% + 15), TileSheet&, , (Tile(Level(J%, i%)).X, Tile(Level(J%, i%)).Y)-(Tile(Level(J%, i%)).X + 15, Tile(Level(J%, i%)).Y + 15)
END IF
X% = X% + 16
NEXT
Y% = Y% + 16
NEXT
'// Drawing Duke
_PUTIMAGE (Duke.X, Duke.Y)-(Duke.X + DukeRect.Width, Duke.Y + DukeRect.Height), DukeImage, , (DukeFrame(Duke.AnimFrame).X, 0)-(DukeFrame(Duke.AnimFrame).X + DukeFrame(Duke.AnimFrame).Width, _HEIGHT(DukeImage))
_DISPLAY
LOOP
TYPE KeyBoardState
Left AS LONG
Right AS LONG
Down AS LONG
Up AS LONG
CTRL AS LONG
SHIFT AS LONG
ALT AS LONG
SPACE AS LONG
ENTER AS LONG
ESC AS LONG
END TYPE
'// The Rect TYPE has two main uses, the first is for sprite animation, the second for bounding
'// RECT collision detection but its also used for tilesheets! Useful Eh?
TYPE Rect
X AS INTEGER
Y AS INTEGER
Width AS INTEGER
Height AS INTEGER
END TYPE
'// The Sprite TYPE contains variables common to all sprites
TYPE Sprite
X AS INTEGER
Y AS INTEGER
AnimFrame AS INTEGER
AnimTime AS DOUBLE
IsMoving AS INTEGER
Direction AS INTEGER
Exists AS INTEGER
END TYPE
SUB KeyState (KeyRef AS KeyBoardState)
KeyRef.ESC = _KEYDOWN(27)
KeyRef.SPACE = _KEYDOWN(32)
KeyRef.Left = _KEYDOWN(19200)
KeyRef.Right = _KEYDOWN(19712)
KeyRef.Down = _KEYDOWN(20480)
KeyRef.Up = _KEYDOWN(18432)
IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN KeyRef.CTRL = True ELSE KeyRef.CTRL = False
IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN KeyRef.ALT = True ELSE KeyRef.ALT = False
IF _KEYDOWN(100303) OR _KEYDOWN(100304) THEN KeyRef.SHIFT = True ELSE KeyRef.SHIFT = False
KeyRef.ENTER = _KEYDOWN(13)
END SUB
'// Determines if any part of two rectangles intersect. returns -1 for true, 0 for false
FUNCTION RECT_Intersect (RECTRef1 AS Rect, RECTRef2 AS Rect)
IF RECTRef1.X <= RECTRef2.X + RECTRef2.Width THEN
IF RECTRef1.X + RECTRef1.Width >= RECTRef2.X THEN
IF RECTRef1.Y <= RECTRef2.Y + RECTRef2.Height THEN
IF RECTRef1.Y + RECTRef1.Height >= RECTRef2.Y THEN
RECT_Intersect = -1
END IF
END IF
END IF
ELSE
RECT_Intersect = 0
END IF
END FUNCTION
'// DUMMY LEVEL - If built in in a level maker this will need to be in an external file. level is 40x15
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,293,294,0,0,0,0,293,294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,295,296,0,0,0,0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,293,294,293,294,0,0,0,293,294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,295,296,295,296,0,0,0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
'// BACKGROUD TILES
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Unseen
Report Spam
Logged
nonexistant person
Guest
Re: Duke Nukem Game Rewrite.
«
Reply #12
on:
June 01, 2011, 07:38:42 pm »
Thanks unseen your comments make lots sense to me. My editor is graphical. Its simple but this is all that it ia as yet. Have a tinker , some of the co-ords arent correct yet.
Code:
REM
DEFLNG A-Z
_TITLE "DukeNukem Editor"
Video& = _NEWIMAGE(800, 600, 32)
Sheet1& = _LOADIMAGE("DNBackground1.bmp", 32)
SCREEN Video&
_FULLSCREEN
DIM SHARED mx%, my%, mbl%, mbr%
Grey& = _RGB32(192, 192, 192)
Pink& = _RGB32(255, 105, 180)
LWhite& = _RGB32(255, 250, 250)
GOSUB Box
GOSUB LoadTiles
_MOUSESHOW
DO
_LIMIT 30
MousePoll
LOCATE 1, 90: PRINT "x="; mx%
LOCATE 2, 90: PRINT "y="; my%
' we in tile paste window
IF mx% >= 8 AND mx% <= 407 THEN
IF my% >= 8 AND my% <= 407 THEN
x% = mx% - 8: y% = my% - 8
xx% = x% \ 16: yy% = y% \ 16
END IF
END IF
' we in tile selection window
IF mx% >= 428 AND mx% <= 684 THEN
IF my% >= 8 AND my% <= 488 THEN
x% = mx% - 428: y% = my% - 8
xx% = x% \ 16: yy% = y% \ 16
IF mbl% = -1 THEN
xxx% = xx% + 1: yyy% = yy% + 1: x1% = (xxx% * 16) - 15: y1% = (yyy% * 16) - 15
LINE ((428 + (xxx% * 16) - 16), (8 + (yyy% * 16)) - 16)-(428 + (xxx% * 16) - 1, 8 + (yyy% * 16) - 1), Pink&, B
_PUTIMAGE (108, 438)-(123, 453), Sheet1&, Video&, ((xxx% * 16) - 15, (yyy% * 16) - 15)-((xxx% * 16) - 1, (yyy% * 16) - 1)
END IF
END IF
END IF
LOCATE 4, 90: PRINT "C="; xx% + 1
LOCATE 5, 90: PRINT "R="; yy% + 1
_DISPLAY
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM
Box:
LINE (0, 0)-(415, 415), Grey&, BF
LINE (8, 8)-(407, 407), LWhite&, BF
FOR t = 8 TO 398 STEP 16
FOR tt = 8 TO 398 STEP 16
LINE (t, tt)-(t + 15, tt + 15), Pink&, B
NEXT tt
NEXT t
LINE (420, 0)-(690, 496), Grey&, BF
LINE (100, 430)-(132, 462), Grey&, BF
RETURN
LoadTiles:
_PUTIMAGE (428, 8)-(684, 488), Sheet1&, Video&
RETURN
SUB MousePoll ()
DO WHILE _MOUSEINPUT
mx% = _MOUSEX: my% = _MOUSEY: mbl% = _MOUSEBUTTON(1): mbr% = _MOUSEBUTTON(2)
LOOP
END SUB
Needs a lot more work. We got a bit to chew over here at the moment.Link to the graphic
http://dl.dropbox.com/u/10291175/DNBackground1.bmp
«
Last Edit: September 08, 2011, 11:18:07 pm by GarrisonRicketson
»
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #13
on:
June 01, 2011, 08:02:35 pm »
It looks fine
, i allways use VQB so i get the Visual Basic style look, i am still making my Wolf3D one and its very complicated (lot's of options/modes that all need accounting for). As for level's, this bit of code converts a two dimensional array (Column, Row) into data style staments in a external file
Code:
'//Convert level into data style statements
FOR i% = 1 TO 50 '// Column
DataString$ = ""
FOR j% = 1 TO 50 '// Row
IF j% > 1 THEN DataString$ = DataString$ + ","
DataString$ = DataString$ + STR$(Walls(i%, j%))
NEXT
PRINT #1, DataString$
NEXT
This bit converts it back from the file into data for the array...
Code:
OPEN GameFile$ FOR INPUT AS #1
FOR i% = 1 TO 50
LINE INPUT #1, DataLine$
RowCnt% = 1
FOR j% = 0 TO LEN(DataLine$)
IF INSTR(j%, DataLine$, ",") > 0 THEN
Level(i%, RowCnt%) = VAL(MID$(DataLine$, j%, INSTR(j%, DataLine$, ",") - j%))
j% = INSTR(j%, DataLine$, ",")
RowCnt% = RowCnt% + 1
ELSE
Level(i%, RowCnt%) = VAL(MID$(DataLine$, j%))
END IF
NEXT
NEXT
I use them in my Wolf3D editor/game engine and they seem to work pretty well.
If i made you a shell for the editor with VQB would you be ok with that? You can do all the function and graphics code, but i'll make the buttons and thier control structures etc that will enable background, foreground sprite mode...etc. I just think it could save a lot of time in the coding as well as make it pretty, I hope we are aiming to impress the community with this. But i don't want to piss you off or overstep the mark, afterall it's your project, feel free to tell me to back/f off if you want
.
All the best mate,
John
p.s Here is VQB02 if you dont have it...
http://dl.dropbox.com/u/8822351/VQB02.zip
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Duke Nukem Game Rewrite.
«
Reply #14
on:
June 01, 2011, 08:38:07 pm »
Quote
It will take me a while to sift through. So far everything seems compatible looking at it quickly. Im ok with adopting your concepts as you have more experience than me.
NO WAY! I have only been coding for about a year and a half, but it seems to suit my mindset, very logical me. I suppose once you have made a game engine, making games comes as second nature.
I have somehow manage to learn to visualise what i want, then some how my brain just says "This is how to do it" (in QB64 at least, C++ is still very iffy, but i am getting there). Sometimes the code works but is not as good as it could be. Take today for an example, i was looking throught the Right mouse button options on my Wolf editor, i noticed it only worked in certain modes and could cause problems if used in the wrong mode. I looked at the code and figure half of it was redundant, changed it and it worked perfectly in all modes! Less code and a better output, thats what i seek for nowadays.
If you want me to add more remarks on my code then i got no problem doing that.
Night night OlDosLover,
John
Report Spam
Logged
Pages: [
1
]
2
3
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Useful Information ,Rules,FAQs,LINKS,etc.
===> INTRODUCE Yourself
=> General QB64 Forum
=> MS DOS, FREE DOS, ANY DOS
-----------------------------
QB64 lessons and tutorials,Games
-----------------------------
=> Lesson Disussion
=> Weekly Lesson
=> Games
-----------------------------
TUTORIALS
-----------------------------
=> QB64 Tutorials
=> Text Adventure
=> QBasic Tutorials
=> Other Tutorials
-----------------------------
UNSEENS GDK+SFML Librarys
-----------------------------
=> Discussions on GDK+SFML
=> GDK+SFML Demos, and projects
-----------------------------
DEMOS
-----------------------------
=> Working QB64 Demos
=> QB64 Games
=> QB64 Programs You Are Proud Of.
=> Function + SUB Club
-----------------------------
OFF TOPIC,and Off The wall
-----------------------------
=> OffTopic and Off the Wall
Powered by
EzPortal
Loading...