Jump to content
IGNORED

Twinner Test...


Impaler_26

Recommended Posts

I thought about remaking a little C64 minigame called "Twinner" with bB. The gameplay is very simple, you have a screen filled with "diamonds", a player and an enemy. You have to collect the diamonds, every time you move the player (smiley-face) the enemy (bad face) moves into the opposite direction.

If the player touches a diamond you get a point, if the enemy touches a diamond you lose a live.

 

I just started with the player movement and have a few questions....

The player/enemy should move from pfpixel to pfpixel and not around the whole screen, so far i'm using this for player movement:

 

if joy0up then player0y=player0y-8:player1y=player1y+8:gosub move_sound
if joy0down then player0y=player0y+8:player1y=player1y-8:gosub move_sound
if joy0left then player0x=player0x-4:player1x=player1x+4:gosub move_sound
if joy0right then player0x=player0x+4:player1x=player1x-4:gosub move_sound

 

This works ok but after the joystick has been pressed in a direction there should be some kind of delay, the players move too fast if you keep the joystick pressed. I was wondering how i can add such a delay?

 

Also my player-boundaries don't seem to work right, if the player is on top of the screen and you press up he reappears at the bottom of the screen...

 

When one of the players touches a pf-pixel it should be turned off, there was a thread about converting player-positions to pf-pixel positions but i can't find it atm... So how can i do this?

 

I attached my first test-file and the C64 game as a disk image so you get a better idea of what i'm trying to do...

twintest.bas

twintest.bas.bin

twinner_C64.zip

Link to comment
Share on other sites

What I'd do is this:

 if a{0} then a{0}=0 else a{0}=1
if joy0left && !a{0} then player0x=player0x-4 : player1x=player1x+4 
if joy0right && !a{0} then player0x=player0x+4 : player1x=player1x-4
if joy0up && !a{0} then player0y=player0y-8 : player1y=player1y+8
if joy0down && !a{0} then player0y=player0y+8 : player0y=player0y-8

Edited by atari2600land
Link to comment
Share on other sites

After playing with the code, I discovered my first post isn't going to work. I did get it to work finally, so check it out.

Thanks, works great!

 

I found the thread i was looking for: http://www.atariage.com/forums/index.php?showtopic=131795.

Tricky topic indeed...

 

I included the player0 position to pf-pixel code posted there:

 

if collision(player0,playfield) then score=score+5 : gosub pixel_off
...
pixel_off
x=(player0x - 17) / 4
y=(player0y - 1) / 8
pfpixel x y off
return

 

But the pf-pixel touched by the player is only turned off if you move over it to the right.

How do i calculate the pf-pixel position so it's turned off as soon as the player touches it?

post-12950-1247429072_thumb.png

twintest1b.bas

twintest1b.bas.bin

Edited by Impaler_26
Link to comment
Share on other sites

Usually I make my joystick checking part of the loop like.. in my Skull Island game I have a for next loop to give a little delay:

 

joyloop
if joy0up then player0y=player0y-8:player1y=player1y+8:gosub move_sound
if joy0down then player0y=player0y+8:player1y=player1y-8:gosub move_sound
if joy0left then player0x=player0x-4:player1x=player1x+4:gosub move_sound
if joy0right then player0x=player0x+4:player1x=player1x-4:gosub move_sound

for x = 0 to 5
drawscreen
next
return

 

Something like that, you get the idea. I use something like that in my Skull Island game. Just have to play with the for x = 0 to 5 line to get a number number in there that feels good. That helped me make it so you press a direction and my cursor didn't just fly off the screen so fast. I also had to set a flag. Either carry = 0 or 1. This would help me determine if someone was carrying a piece or not so I could pick up or put down pieces.

 

Look for "debounce" routine on here. There might be a thread about it. I forget.

Edited by yuppicide
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...