Slot machine error
in
Programming Questions
•
2 years ago
Im working on a slot machine program. it should at least be displaying some of it, but for one reason or another i just get a small screen.
- int clickcount = 0;
- class Slot {
- float num1;
- int adder;//number that adds up slot number
- Slot() {
- num1=1;
- adder=1;
- }
- void calculate() {
- num1 = num1 + adder;
- if (num1 >= 10 || num1 < 1) {
- adder = -adder;
- }
- }
- void display() {
- stroke(0,0,255);
- rect(230,230,40,40);//box for slot
- text(num1,250,250);//displays slot with number being calculated
- }
- void mouseClicked(){
- num1= num1;
- clickcount = clickcount + 1;
- }
- Slot slot;
- void setup(){
- size(500,500);
- slot = new Slot();
- }
- void draw() {
- slot.calculate();
- slot.display();
- background(0);
- }
- }
1