Jump to content
IGNORED

Pineapple: a 7800BASIC exercise.


Recommended Posts

Rand returns the next in a fixed (but very long) sequence of arbitrary numbers. Where it starts in that sequence is determined by the seed value, but there's no guarantee that the seed value will be different each time.

If you call rand each frame and ignore the result you'll get a seemingly more randomised sequence because the arbitrary number of frames between when you actually need to use a random number makes the whole thing unpredictable.

Link to comment
Share on other sites

Calling rand each frame still won't make it random:



titlescreenloop
    stupid=rand

    drawscreen
    
    if joy0fire1 && !keygot{0} then keygot{0}=1
    if !joy0fire1 && keygot{0} then score0=0 : keygot=0 :  goto main_setup    
    
    goto titlescreenloop

Link to comment
Share on other sites

I think it's an emulator issue. The random function is seeded by the value of a timer, which would be random on real hardware, but might not be on some emulators. 

 

Edit: also adding a call to rand every frame where there is no joystick input (or vice versa) instead of just every frame could help. 

Link to comment
Share on other sites

New changes.

  • Papaya power-up's point value now depends on how fast you get it. It starts at 50 points when it first comes on screen and works down to 0.
  • Bananas' speed now varies. The bananas get faster every ten seconds once all 6 appear on screen until they reach their maximum speed.

 

pineapple2020_09_24.zip

Link to comment
Share on other sites

Minor graphic changes to the title screen and font:

title20200925.png.8067414f8cb3468d2a39981988fb2300.png

The in-game is mostly the same:

ingame20200925.png.5f80a778d8e7683fde328274190ff55f.png

I've noticed that when using the ProSystem emulator, the sound effects are delayed a little bit. Using MAME and the other ones, they work fine. If someone would like to test this on a real 7800, it'd be much appreciated.

pineapple2020_09_25.zip

Link to comment
Share on other sites

Is something like my mockup below possible?

why.png.05927e3d8e44caf6170ee0c6420ba603.png

Since I'm only using the allowed amount of three colors. But when I try to use this as the basis for the 'alphabet', the purple color goes to black.

brix6.png.bc6f40fab07908e93d068bfa673b5fc3.png

This is the alphabet I'm using. Why isn't the third color being used at all?


  alphachars ' a'
  alphadata ingamescreen1 brix6
    'aaaaaaaaaaaaaaaaaaaa'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'
    'a                  a'    
    'a                  a'
    'aaaaaaaaaaaaaaaaaaaa'
end

I'm about ready to pull all my hair out.

Link to comment
Share on other sites

You sometimes need to reorder the color indexes during the incgraphic, to get them to match with your palette entries, or else, rearrange your palette entries to match the png indexes.

 

Using the zip above and your brix6.png, If I use "incgraphic pineapplegfx/brix6.png 0 2 1 3"

 

and then I add blue to your palette entries...

        P0C1=$34
        P0C2=$94
        P0C3=14
 

...then it looks more or less like your mock-up.

  • Like 1
Link to comment
Share on other sites

I set the zone height to 16. A bunch of my free space vanished. Instead of having 9997 bytes in the main area, I now only have 2175. But I read that having the zone height be 16 means that the 7800 doesn't have to work as hard (which I don't know why since everything would be bigger instead of smaller.) So now I could add a ton more bananas, but I won't because then the game would get super hard.

pineapple1player.png.075e877fa31c770404cda1a3292f5eb2.png

I had to move the score down though, so both scores are on the same line, but player 1's score is on the left while player 2's is on the right.

Link to comment
Share on other sites

I totally revamped the banana moving code. There's now a lot less of it. Just one chunk of code for changing the bananas' movement and separate variables for each banana to have.

I also changed up the colors a little. I made the background brighter and changed the papaya color.

pineapple2players.png.eca65565f2a21a5a2e22a196228a9272.png

 

Link to comment
Share on other sites

  • 2 months later...

How do I do this? It always says "it was a tie." even if score1>score0.


    if numplayers=1 then plotchars '&               &' 1 12 6
    if numplayers=2 && score0>score1 then plotchars '& player 1 won. & ' 1 12 6
    if numplayers=2 && score0<score1 then plotchars '& player 2 won. & ' 1 12 6
    if numplayers=2 && score0=score1 then plotchars '& it was a tie. & ' 1 12 6    

Link to comment
Share on other sites

You could something like this (untested but based on my high-score check):

 dim score0Var0 = score0
 dim score0Var1 = score0+1
 dim score0Var2 = score0+2
 dim score1Var0 = score1
 dim score1Var1 = score1+1
 dim score1Var2 = score1+2
 
ValidateScore0BiggerThanScore1
 rem validate each byte
 if score0Var0 > score1Var0 then goto _validatedScore0IsBiggerThanScore1
 if score0Var0 < score1Var0 then goto _validateHighScoreExit
 if score0Var1 > score1Var1 then goto _validatedScore0IsBiggerThanScore1 
 if score0Var1 < score1Var1 then goto _validateHighScoreExit
 if score0Var2 > score1Var2 then goto _validatedScore0IsBiggerThanScore1
 goto _validateScore0BiggerThanScore1Exit

_validatedScore0IsBiggerThanScore1
 rem if you reach here score0 > score1
 
_validateScore0BiggerThanScore1Exit
 return

 

Link to comment
Share on other sites

OK, I think it works now. I used this code:


    if score1Var0>score0Var0 then goto player2won
    if score1Var0<score0Var0 then goto player1won       
    if score1Var1>score0Var1 then goto player2won
    if score1Var1<score0Var1 then goto player1won         
    if score1Var2>score0Var2 then goto player2won
    if score1Var2<score0Var2 then goto player1won

    plotchars 'it was a tie.' 0 28 6

 

pineapplegameover.png

  • Like 1
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...
  • Recently Browsing   0 members

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