I need help adding a score board to a simple pong game can anyone help?
1 | showText(""+scoreA+"\n"+scoreB, getWidth()-80, getHeight()/2); |
1 | showText(""+scoreA+"\n"+scoreB, getWidth()-80, getHeight()/2); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)/** * Write a description of class PongWorld here. * * @author (your name) * @version (a version number or a date) */public class PongWorld extends World{ /** * Constructor for objects of class PongWorld. * */ public PongWorld() { // Create a new world with 20x20 cells with a cell size of 10x10 pixels. super(700, 500, 1); addObject(new Paddle(1), 350, 30); addObject(new Paddle(2), 350, 470); addObject(new Ball(), 350, 250); }} |
1 | public int scoreA, scoreB; |
1 2 3 4 | public void act(){ shotText(""+scoreA+"\n"+scoreB, getWidth()-80, getHeight()/2);} |
1 | public int scoreA, scoreB; |
1 2 3 4 | public void act(){ shotText(""+scoreA+"\n"+scoreB, getWidth()-80, getHeight()/2);} |