Jump to content



0

Paddle isn't affected by mouse in Stella


4 replies to this topic

#1 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Fri Feb 15, 2008 11:41 AM

I'm trying to test the paddle movement in Stella and for some reason the paddle doesn't move to key presses or mouse movements reguardless of what i press or move. I have code to the move paddle, so i have eliminated that possibility. I know the paddle is being moved by the paddle controller in Stella because the paddle is being positioned at the top of my screen by code paddle movement and boundry checking code. If i remove the line:
player0y = paddle * 2 + 1

That paddle stays centered like it should when the game is first started. I tried pressing Ctrl 0 and the message "Mouse controls Paddle 0" appears on screen, but nothing happens no visible changes.

Heres my full code:
 rem Open Source Pong
 rem an Open Source Pong Remake
 rem Updated: Feburary 10, 2008
 rem Website: http://opensourcepong.freepgs.com

 rem set the rom size
 set romsize 4k

 rem set kernel options
 rem readpaddle - set it so the paddle controlers are read
 set kernel_options no_blank_lines readpaddle

 rem set an alias for the ball's x velocity
 dim ballxvelocity = a

 rem set an alias for the ball's y velocity
 dim ballyvelocity = b

 rem set an alias for the player1's score
 dim player1score = c

 rem set an alias for the player2's x score
 dim player2score = d

 rem set player1's inital x positon
 player0x = 15

 rem set player1's inital y positon
 player0y = 45

 rem set player2's inital x positon
 player1x = 140

 rem set player2's inital y positon
 player1y = 45

 rem set ball's inital x positon
 ballx = 80

 rem set ball's inital y positon
 bally = 45

 rem start of the game loop
gameLoop

 rem color the background black'
 COLUBK = 0

 rem set the color of the playfield to white
 COLUPF = 14

 rem define the playfield
 playfield:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
................................
................................
................................
................................
................................
................................
................................
................................
................................
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

 rem color player 1's paddle
 COLUP0 = 14

 rem define player 1's sprite
 player0:
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
end

 rem color player 2's paddle
 COLUP1 = 14

 rem define player 2's sprite
 player1:
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
 %00011000
end

 rem read paddle 0, use it to position player0x across the screen
 currentpaddle = 0

 rem draw the game screen
 drawscreen

 rem set player1's y position to the paddle control's axis
 rem multiplied by 2 plus 1
 rem player0y = paddle * 2 + 1

 rem make sure the player doesn't go off the top screen
 if player0y > 153 then player0y = 153

 rem make sure the player doesn't go off the bottom screen
 if player0y < 8 then player0y = 8

 rem redraw the screen
 drawscreen

 goto gameLoop

Any ideas?

Sincerely,

Open Source Pong

#2 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Fri Feb 15, 2008 11:24 PM

Update: Still no luck.

#3 SpiceWare ONLINE  

SpiceWare

    Quadrunner

  • 5,983 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Fri Feb 15, 2008 11:46 PM

You have to tell Stella that a paddle is plugged into the left port. Check the first post in the Medieval Mayhem thread if you don't know how to do that.

#4 SeaGtGruff OFFLINE  

SeaGtGruff

    River Patroller

  • 4,543 posts
  • Location:Georgia, USA

Posted Sat Feb 16, 2008 12:19 AM

View PostSpace Xscape, on Fri Feb 15, 2008 12:41 PM, said:

I'm trying to test the paddle movement in Stella and for some reason the paddle doesn't move to key presses or mouse movements reguardless of what i press or move.
Okay, I think I see the problem. After you compile and run it in Stella, you need to press TAB to bring up the menu, then select GAME PROPERTIES and select PADDLES for the left controller. Then exit the menu, press "\" and restart the ROM.

Also, you have some coordinate problems with the paddle. In batari Basic, paddle will return a value between 0 and 80, and you want the paddle to control the y position, which ranges from about 1 to 88, so you don't need "paddle * 2 + 1." (That would be used if you want the paddle to control the x coordinate, which ranges from 1 to 160.) Also, you don't need two drawscreens in the loop. I've updated your code so it works better, just don't forget to select PADDLES for the left controller, because it defaults to JOYSTICK.

Michael
PS-- I also moved some of the code to be above the loop, since you don't need to keep repeating those statements each time you loop, once is enough.

Attached Files



#5 stephena OFFLINE  

stephena

    Stargunner

  • 1,966 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Sat Feb 16, 2008 8:45 AM

View PostSpiceWare, on Sat Feb 16, 2008 2:16 AM, said:

You have to tell Stella that a paddle is plugged into the left port. Check the first post in the Medieval Mayhem thread if you don't know how to do that.
Also, the paddle movement in Stella (wrt emulation using the mouse or keyboard) is not entirely accurate right now. You can notice it in Night Driver, where the paddle almost doesn't work at all. I've fixed the problem, and it will be included in the next release.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users