Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CSE2102_group_37/src/main/Controller.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (30 sloc)
685 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.awt.Graphics; | |
import java.util.LinkedList; | |
public class Controller { | |
private LinkedList<Laser> l = new LinkedList<Laser>(); | |
Laser tempLaser; | |
Game game; | |
public Controller(Game game){ | |
this.game = game; | |
addLaser(new Laser(100, 300, game)); | |
} | |
public void tick(){ | |
for(int i = 0; i < l.size(); i++){ | |
tempLaser = l.get(i); | |
tempLaser.tick(); | |
} | |
} | |
public void render(Graphics g){ | |
for(int i = 0; i < l.size(); i++){ | |
tempLaser = l.get(i); | |
tempLaser.render(g); | |
} | |
} | |
public void addLaser(Laser laser){ | |
l.add(laser); | |
} | |
public void removeLaser(Laser laser){ | |
l.remove(laser); | |
} | |
} |