Jump to content
IGNORED

Help with 1st game


Lewis2907
 Share

Recommended Posts

Hello,

 

I am trying to get player0 to fire the missile and hit player1. I can complete this if I modify the program by taking out my cutscenses and goto statements. If anyone is able to help me figure out where I went wrong it would be great as I plan to add more cutscenes and 4 more levels. Eventually I will learn how the title screen kernal works as well to create a better game.

 

Also credits to the other programers code i used to build my game below. I took apart some others codes that I could understand and used it below. My ulitmate goal is to make a few games and have them loaded on to a cartage and play on my 2600 I kept from my childhood.

 

 

Gamestart

rem setup cut scenes

set tv pal

set romsize 32kSC

const pfres=32

set kernel_options playercolors player1colors pfcolors

set optimization speed

set smartbranching on

set optimization noinlinedata

set optimization inlinerand

 

rem ---------------------------------------------

rem setup title screen and cut scences

rem ---------------------------------------------

 

rem ----------Title Screen-----------------------

_Titlescreen_Loop

goto titlescreen

returntitlescreen

drawscreen

if joy0fire then goto __Cutscene_Loop2

goto _Titlescreen_Loop

 

rem ----------Cut Scenes-------------------------

__Cutscene_Loop2

goto Cutscene1

returnCutscene1

t=t+1

if t=100 then goto __Cutscene_Loop3

drawscreen

goto __Cutscene_Loop2

 

__Cutscene_Loop3

goto Cutscene2

returnCutscene2

t=t+1

if t=100 then goto __Cutscene_Loop4

drawscreen

goto __Cutscene_Loop3

 

__Cutscene_Loop4

goto Cutscene3

returnCutscene3

s=s+1

if s=100 then goto __Cutscene_Loop5

drawscreen

goto __Cutscene_Loop4

 

__Cutscene_Loop5

goto Cutscene4

returnCutscene4

r=r+1

if r=100 then goto jump2

drawscreen

goto __Cutscene_Loop5

jump2

 

 

rem -------Start Level 1---------------------------------------

 

level1

 

rem scrolling background speed

dim _Scroll_Control = a.b

 

rem player one shiled strength

const pfscore = 1

pfscore1 = 3

 

rem define the playing field boundaries

const _Edge_Top = 9

const _Edge_Bottom = 88

const _Edge_Left = 1

const _Edge_Right = 152

 

rem missile

missile0x = 64

missile0y = 64

missile1height = 4

NUSIZ0 = 00

 

rem load level 1 playing field

goto playingfield1

returnplayingfield1

drawscreen

 

rem go get player sprites

goto hero1

returnhero1

drawscreen

 

goto enemy1

returnenemy1

drawscreen

 

rem make sprites equal players

dim hero1=player0

dim enemy1=player1

 

rem player positions

player0x = 55:player0y = 100

player1x = 90:player1y = 100

 

 

mainlevel1

draw_loop

 

rem fire missile

if missile0y > 240 then goto skip

missile0y = missile0y-2: goto draw_loop

skip

if joy0fire then missile0y = player0y-2:missile0x=player0x+4

 

rem scrolling backgoround

if !joy0left then goto __Skip_left

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll right : _Scroll_Control = 0

__Skip_left

 

if !joy0right then goto __Skip_right

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll left : _Scroll_Control = 0

__Skip_right

 

if !joy0down then goto __Skip_down

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll down : _Scroll_Control = 0

__Skip_down

 

if !joy0up then goto __Skip_up

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll up : _Scroll_Control = 0

__Skip_up

 

rem enemy movemement

if player1y < player0y then player1y = player1y+1

if player1y > player0y then player1y = player1y-1

if player1x < player0x then player1x = player1x+1

if player1x > player0x then player1x = player1x-1

player1x=player1x:player1y = player1y

 

rem player movement

if joy0up && player0y > _Edge_Top then player0y = player0y - 2: goto jump

if joy0down && player0y < _Edge_Bottom then player0y = player0y + 2: goto jump

if joy0left && player0x > _Edge_Left then player0x = player0x - 2: goto jump

if joy0right && player0x < _Edge_Right then player0x = player0x + 2: goto jump

 

rem player score

if collision(missile0,player1) then score=score+1:player1x=rand/2:player1y=0:missile0y=255

if collision(player0,player1) then score=score-1:player1x=rand/2:player1y=0:missile0y=255:pfscore1 = pfscore1-1

 

rem if player shields go out go to gameover

if !pfscore1=0 then goto gameover

 

jump

drawscreen

goto mainlevel1

goto level1

 

rem ------------------------------------------------------------

rem Cut Scences, Sprites, Title Screen etc below ---------------

rem ------------------------------------------------------------

 

titlescreen

pfcolors:

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

end

 

playfield:

XXXX..XXX..X...X..XXX.....X.....

X....X...X.X...X.X.......X.X....

XXXX.XXXXX.X...X.XXX....XXXXX...

...X.X...X..X.X..X.....X..X..X..

XXXX.X...X...X....XXX....X.X....

................................

.XXX..XXX..XXXXX.XXXXX.X..X.....

X....X...X.X...X...X...X..X.....

XXX..XXXXX.XXXX....X...XXXX.....

X....X...X.X...X...X...X..X.....

.XXX.X...X.X...X...X...X..X.....

................................

................................

........XXXX....X...X...........

........X...X....X.X............

........X..X......X.............

........X...X.....X.............

........XXXX......X.............

................................

................................

XXXX...XXX..XXXX.XXXX.XXX.X..X..

X...X.X...X.X..X.X..X.X...X..X..

X...X.XXXXX.XXX..XXX..XXX.X..X..

X...X.X...X.X..X.X..X.X...X..X..

XXXX..X...X.X..X.X..X.XXX.XX.XX.

................................

.....X...XXX.X...X.XXX.XXXX.....

.....X...X...X...X..X..X........

.....X...XX..X.X.X..X..XXXX.....

.....X...X...X.X.X..X.....X.....

.....XXX.XXX..X.X..XXX.XXXX.....

................................

end

goto returntitlescreen

 

Cutscene1

pfcolors:

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

end

 

playfield:

................................

.XXXX.X..X..XXX..XXX...XX..X...X

.X....X..X.X...X.X..X.X..X.X...X

.XXXX.XXXX.XXXXX.X..X.X..X.X.X.X

....X.X..X.X...X.X..X.X..X.X.X.X

.XXXX.X..X.X...X.XXX...XX...X.X.

................................

....XXX..XXXX..XXX...XXX.XXXX...

...X.X.X.X....X...X.X....X......

...X.X.X.XXX..X.XX..X....XXXX...

...X...X.X....X...X.X.......X...

...X...X.XXXX.X...X..XXX.XXXX...

................................

................................

.......XXXXXXXX.................

......XXXXXXXXXX................

.....XX.........................

.....XX....XXX..................

.....XXXXXXXXXXX..........X.....

......XXXX................X.....

.......XXXXXXX...........XX.....

..XXXX...XXXX..XXXXX....XX.X....

X...XXXX......XXX......XX.XX....

XXXXX...XXXXXX....XXX....XX.....

XXX.XXXX......XXX..XXX..XX......

XX...X..XXXXXX..XX..XXXXX.......

XXX..XXX.......XXX...XXX........

XXXX..XXXXXXXXXXXX..............

.XXXX..XXXX..XXXX...............

.X.X.X..XX.XX.XX................

..XXX....XX..XX.................

....X...XX.XX.XX................

end

goto returnCutscene1

 

Cutscene2

pfcolors:

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

end

 

playfield:

................................

X..X.X.X...X........XXX..X...X..

X.X..X.X...X.......X...X.X...X..

XX...X.X...X.......XXXXX.X...X..

X.X..X.X...X.......X...X.X...X..

X..X.X.XXX.XXX.....X...X.XXX.XXX

................................

.XXX..XXXX....XXX.X..X.XXX..XXX.

X...X.X........X..X..X.X...X.X.X

X...X.XXX......X..XXXX.XX..X.X.X

X...X.X........X..X..X.X...X...X

.XXX..X........X..X..X.XXX.X...X

................................

................................

.......XXXXXXXX.................

......XXXXXXXXXX................

.....XX.........................

.....XX....XXX..................

.....XXXXXXXXXXX..........X.....

......XXXX................X.....

.......XXXXXXX...........XX.....

..XXXX...XXXX..XXXXX....XX.X....

X...XXXX......XXX......XX.XX....

XXXXX...XXXXXX....XXX....XX.....

XXX.XXXX......XXX..XXX..XX......

XX...X..XXXXXX..XX..XXXXX.......

XXX..XXX.......XXX...XXX........

XXXX..XXXXXXXXXXXX..............

.XXXX..XXXX..XXXX...............

.X.X.X..XX.XX.XX................

..XXX....XX..XX.................

....X...XX.XX.XX................

end

goto returnCutscene2

 

Cutscene3

pfcolors:

$16

$16

$16

$16

$16

$40

$16

$16

$16

$16

$16

$44

$44

$0E

$0E

$0E

$0C

$0C

$84

$0C

$0C

$0C

$0C

$0C

$0E

$0E

$0E

$0E

$0E

$0C

$84

$84

end

 

playfield:

.XXX..XX..XXX....XXX...XX...XXX.

..X..X..X.X..X...X..X.X..X.X....

..X..X..X.XXX....X..X.X..X.X.XXX

..X..X..X.X......X..X.X..X.X...X

..X...XX..X......XXX...XX...XXX.

................................

........X...X.X..X.X...X........

........X...X.X..X..X.X.........

........X.X.X.XXXX...X..........

.........X.X..X..X...X..........

................................

.............X.X................

.............XXXXXX.............

.............XXXX.XX............

.............XX.XXXX............

..............XX.XX.............

..............X.XX..............

.............X.XXX.XXXXXXX......

............XXXXXXXXX.X.........

...............X.X..............

..............X.X.X.............

..............XX.X.X............

.............XX.X.X.X...........

............XX.XX.XX.X..........

............X.XX..XXXX..........

...........XXXX..XX.XX..........

...........XX.X.XX.XX...........

..........XX.XX.XXXX............

.........XX.XX.XX.XX............

.........X.XX..X..XX............

.........X..X...X..X............

........X..X...X..X.............

end

goto returnCutscene3

 

Cutscene4

pfcolors:

$16

$16

$16

$16

$16

$40

$16

$16

$16

$16

$16

$44

$44

$0E

$0E

$0E

$0C

$0C

$84

$0C

$0C

$0C

$0C

$0C

$0E

$0E

$0E

$0E

$0E

$0C

$84

$84

end

playfield:

................................

................................

................................

................................

................................

................................

..XXX.XXX.XXX....XX..X..X..X....

...X...X..XX....X..X.XX.X..X....

...X...X....X...X..X.X.XX.......

..XXX..X..XXX....XX..X..X..X....

................................

.............X.X................

.............XXXXXX.............

.............XXXX.XX............

.............XX.XXXX............

..............XX.XX.............

..............X.XX..............

.............X.XXX.XXXXXXX......

............XXXXXXXXX.X.........

...............X.X..............

..............X.X.X.............

..............XX.X.X............

.............XX.X.X.X...........

............XX.XX.XX.X..........

............X.XX..XXXX..........

...........XXXX..XX.XX..........

...........XX.X.XX.XX...........

..........XX.XX.XXXX............

.........XX.XX.XX.XX............

.........X.XX..X..XX............

.........X..X...X..X............

........X..X...X..X.............

end

goto returnCutscene4

 

playingfield1

pfcolors:

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

$16

end

playfield:

................................

................................

................................

................................

................................

.....XX.....XX..................

...XX....XXXXXXX................

...X...XXXXXXXX.................

....X.XXXXXXXXX.................

.......XXXX.....................

........XXXX....................

.........X..........X.......XX..

..................XX.....XXXXX..

.................X..X.XXXXXX....

.....XXXX.......XX.XXXXXXXXXXX..

...XXXXXXXX....XXXXXXXXXXXXX....

..XXXXXXX...XX....XXXXXXXXXXX...

.XXXXXX...XXXXX..XX.XXXXXXXXXX..

.XXXXXXXX.XXXXXX...XXXXXXXXXXX..

.XXXXXXXXXXXX........XX..XXXXX..

..XXXXXXXXXX.......XX.X.XXXXX...

...XXX.....X...XXXXXXX...XX.X...

......X.......XXXXXXXXXXXXXX.XX.

.....XXXXXXX....XXXXXX...XXX....

.......XXXXXXXX...XXXXXX...XXXX.

........XXXXX.......XXXX........

.........XXXX.......XXXX........

.........XXX........XXX.........

........XX.........XX.....X.XX..

..........X.............XXXXXXX.

.........................XXXX...

................................

end

goto returnplayingfield1

 

rem ------------level 1 sprites--------------

hero1

player0:

%00101000

%00111000

%00010000

%10010010

%01111100

%00111000

%00010000

%00010000

end

COLUP0 = #$05

goto returnhero1

 

enemy1

player1:

%01000010

%00111100

%00100100

%01000010

%11011011

%01000010

%00100100

%00011000

end

player1color:

$40

$D0

$D0

$D0

$D0

$D0

$D0

$D0

end

goto returnenemy1

 

rem -------------------------Gameover Screen--------------------------

 

gameover

drawscreen

 

playfield:

................................

...XXXX..XXX...XXX...XXXX.......

..X.....X...X.X.X.X.X...........

..X..XX.XXXXX.X.X.X.XXX.........

..X...X.X...X.X.X.X.X...........

...XXX..X...X.X...X..XXXX.......

................................

...XXX..X...X..XXXX.XXXXX.......

..X...X.X...X.X.....X...X.......

..X...X.X...X.XXX...XXXX........

..X...X..X.X..X.....X...X.......

...XXX....X....XXXX.X...X.......

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

end

 

COLUBK = $0F

COLUPF = $72

 

if joy0down then goto Gamestart

goto gameover

end

 

Save Earth Complete - Clean Version..txt

Link to comment
Share on other sites

Thanks for the reply. I will try to look up gosubs and how to use them. I found a example with goto and I was able to incorporate it into my program. The game itself works but player0 flashes a lot and won't shoot the missile. I have the same part level 1 as stand alone and everything works. once i figure out the player0 and missile erros I plan to add another "if" statement when you shoot the enemy 5 times goto level 2. I have built 4 levels as stand alone. I am trying to compile them into cut scene, level 1, cut scene level 2 etc.

 

Then I have another idead after I learn the basics of the titlescreen kernel.

 

below is level 1 as a stand alone. Of course I used others source codes and modified them the best i could.

 

rem **********************************

rem *<filename> *

rem *<description> *

rem *<author> *

rem *<contact info> *

rem *<license> *

rem **********************************

 

gamestart

 

set tv pal

set romsize 32kSC

set kernel

const pfres=32

dim _Scroll_Control = a.b

 

rem player one shiled strength

const pfscore = 1

pfscore1 = 3

 

playfield:

XXXX..XXX..X...X..XXX.....X.....

X....X...X.X...X.X.......X.X....

XXXX.XXXXX.X...X.XXX....XXXXX...

...X.X...X..X.X..X.....X..X..X..

XXXX.X...X...X....XXX....X.X....

................................

.XXX..XXX..XXXXX.XXXXX.X..X.....

X....X...X.X...X...X...X..X.....

XXX..XXXXX.XXXX....X...XXXX.....

X....X...X.X...X...X...X..X.....

.XXX.X...X.X...X...X...X..X.....

................................

................................

........XXXX....X...X...........

........X...X....X.X............

........X..X......X.............

........X...X.....X.............

........XXXX......X.............

................................

................................

XXXX...XXX..XXXX.XXXX.XXX.X..X..

X...X.X...X.X..X.X..X.X...X..X..

X...X.XXXXX.XXX..XXX..XXX.X..X..

X...X.X...X.X..X.X..X.X...X..X..

XXXX..X...X.X..X.X..X.XXX.XX.XX.

................................

.....X...XXX.X...X.XXX.XXXX.....

.....X...X...X...X..X..X........

.....X...XX..X.X.X..X..XXXX.....

.....X...X...X.X.X..X.....X.....

.....XXX.XXX..X.X..XXX.XXXX.....

................................

end

 

title

COLUBK = #$0F

COLUPF = #$72

drawscreen

if joy0fire then goto skiptitle

goto title

skiptitle

 

rem define the playing field boundaries

const _Edge_Top = 9

const _Edge_Bottom = 88

const _Edge_Left = 1

const _Edge_Right = 152

 

rem missile

missile0x = 64

missile0y = 64

missile1height = 4

NUSIZ0 = 00

 

playfield:

................................

................................

................................

................................

................................

....XXX.....XX..................

...XX....XXXXXXX................

...X...XXXXXXXX.................

......XXXXXXXXX.................

.......XXXXXXX..................

........XXXX..................XX

.........X..................XXXX

..................XXX.....XXXXXX

.....X...........XXXXX...XXXXXXX

...XXXXXX........XX.XX...XXXXXXX

..XXXXXXXXX.......XXXXXXXXXXXXXX

XXXXXXXXX...XX.......XXXXXXXXXXX

XXXXXXX...XXXXX....X.XXXXXXXXXXX

XXXXXXXXX.XXXXXX....XXXXXXXXXXXX

XXXXXXXXXXXXX........XX..XXXXXXX

.XXXXXXXXXXX........XX.X.XXXXXXX

..XXXX.....X....XXXXXXX...XX.XX.

......X..........XXXXXXX..XX.XX.

.....XXXXXXX......XXXXXX...X....

.......XXXXXXXX.....XXXXXX....XX

........XXXXX.......XXXX.......X

.........XXXX.......XXXX........

.........XXX........XXX.........

........XX...........X....X.XX..

........X................XXXXXX.

.........................XXXXXX.

..........................X.XX..

end

 

player0x = 75:player0y = 80

player1x = 20:player1y = 100

 

main

 

rem playfield background colors

COLUBK = #$10

COLUPF = #$30

 

player0:

%00101000

%00111000

%00010000

%10010010

%01111100

%00111000

%00010000

%00010000

end

COLUP0 = #$05

 

set kernel_options player1colors

 

player1:

%01000010

%00111100

%00100100

%01000010

%11011011

%01000010

%00100100

%00011000

end

player1color:

$40

$D0

$D0

$D0

$D0

$D0

$D0

$D0

end

 

 

rem fire missile

if missile0y > 240 then goto skip

missile0y = missile0y-2: goto draw_loop

skip

if joy0fire then missile0y = player0y-2:missile0x=player0x+4

 

draw_loop

drawscreen

 

rem scrolling backgoround

if !joy0left then goto __Skip_left

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll right : _Scroll_Control = 0

__Skip_left

 

if !joy0right then goto __Skip_right

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll left : _Scroll_Control = 0

__Skip_right

 

if !joy0down then goto __Skip_down

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll down : _Scroll_Control = 0

__Skip_down

 

if !joy0up then goto __Skip_up

_Scroll_Control = _Scroll_Control + 0.8

if _Scroll_Control > 1 then pfscroll up : _Scroll_Control = 0

__Skip_up

 

rem enemy movemement

if player1y < player0y then player1y = player1y+1

if player1y > player0y then player1y = player1y-1

if player1x < player0x then player1x = player1x+1

if player1x > player0x then player1x = player1x-1

player1x=player1x:player1y = player1y

 

rem player movement

if joy0up && player0y > _Edge_Top then player0y = player0y - 2: goto jump

if joy0down && player0y < _Edge_Bottom then player0y = player0y + 2: goto jump

if joy0left && player0x > _Edge_Left then player0x = player0x - 2: goto jump

if joy0right && player0x < _Edge_Right then player0x = player0x + 2: goto jump

 

rem player score

if collision(missile0,player1) then score=score+1:player1x=rand/2:player1y=0:missile0y=255

if collision(player0,player1) then score=score-1:player1x=rand/2:player1y=0:missile0y=255:pfscore1 = pfscore1-1

 

rem if player shields go out go to gameover

if !pfscore1=0 then goto gameover

 

jump

goto main

 

gameover

drawscreen

 

playfield:

................................

...XXXX..XXX...XXX...XXXX.......

..X.....X...X.X.X.X.X...........

..X..XX.XXXXX.X.X.X.XXX.........

..X...X.X...X.X.X.X.X...........

...XXX..X...X.X...X..XXXX.......

................................

...XXX..X...X..XXXX.XXXXX.......

..X...X.X...X.X.....X...X.......

..X...X.X...X.XXX...XXXX........

..X...X..X.X..X.....X...X.......

...XXX....X....XXXX.X...X.......

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

................................

end

 

COLUBK = $0F

COLUPF = $72

 

if joy0down then goto gamestart

goto gameover

end

Link to comment
Share on other sites

AA Team,

 

I have it sort of working. My issue was that I lost the missiles using "set kernel_options player1colors no_blank_lines pfcolors" so i am using the "ball" in it's place. Player0 is now solid black with no color. I have tried COLUR0, player0color: to change the color but unable to. Also I am trying to incorporate sprites 2-9 to have more enemy and different shapes to fight or innocent bystanders like the car in level 2 driving through. I think if i can work out the above mentioned issues I should be able to add sound then the other stand alone levels I have built.

 

My plan is to have 5 levels (fairly easy to beat) cut sences (eventually work my way up to using titlescreen kernel) and background music for each level with different sound effects. Then I will try to work on a more difficult game that I have in mind.

 

******Save Earth Complete - Clean Version..txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...