-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from sharris40/sprint2_Kody_Attacks_Fix
Sprint2 kody attacks fix
- Loading branch information
Showing
11 changed files
with
473 additions
and
101 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package edu.uco.sdd.rocketdog.model; | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
import javafx.animation.FadeTransition; | ||
import javafx.event.EventHandler; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.input.KeyCode; | ||
import javafx.scene.input.KeyEvent; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.media.MediaView; | ||
import javafx.stage.Modality; | ||
import javafx.stage.Stage; | ||
import javafx.stage.StageStyle; | ||
import javafx.util.Duration; | ||
|
||
/** | ||
* | ||
* @author Sophia | ||
*/ | ||
public class CutSceneStage { | ||
|
||
Stage window; | ||
Stage root; | ||
MediaView mediaView; | ||
CutScenes scene1; | ||
String mediaURL; | ||
|
||
public Stage CutSceneStage(String mURL) { | ||
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1), mediaView); | ||
window = new Stage(); | ||
this.setMediaURL(mURL); | ||
window.setAlwaysOnTop(true); | ||
window.setFullScreenExitHint("Press ESC"); | ||
window.initModality(Modality.APPLICATION_MODAL); | ||
window.initStyle(StageStyle.UNDECORATED); | ||
|
||
scene1 = new CutScenes(mediaURL, 5000); | ||
this.setMediaView(scene1.getMediaView()); | ||
|
||
BorderPane borderPane = new BorderPane(); | ||
borderPane.setStyle("-fx-background-color: Black"); | ||
mediaView.setFitWidth(1000); | ||
mediaView.setFitHeight(924); | ||
mediaView.setPreserveRatio(false); | ||
|
||
borderPane.setCenter(mediaView); | ||
|
||
Scene scene = new Scene(borderPane, 1000, 924); | ||
scene.setOnKeyPressed((KeyEvent ke) -> { | ||
if (ke.getCode() == KeyCode.ESCAPE) { | ||
window.close(); | ||
} | ||
}); | ||
window.setScene(scene); | ||
return window; | ||
|
||
} | ||
|
||
public String getMediaURL() { | ||
return mediaURL; | ||
} | ||
|
||
public void setMediaURL(String mediaURL) { | ||
this.mediaURL = mediaURL; | ||
} | ||
|
||
public Stage getWindow() { | ||
return window; | ||
} | ||
|
||
public void setWindow(Stage window) { | ||
this.window = window; | ||
} | ||
|
||
public Stage getRoot() { | ||
return root; | ||
} | ||
|
||
public void setRoot(Stage root) { | ||
this.root = root; | ||
} | ||
|
||
public MediaView getMediaView() { | ||
return mediaView; | ||
} | ||
|
||
public void setMediaView(MediaView mediaView) { | ||
this.mediaView = mediaView; | ||
} | ||
|
||
public CutScenes getScene1() { | ||
return scene1; | ||
} | ||
|
||
public void setScene1(CutScenes scene1) { | ||
this.scene1 = scene1; | ||
} | ||
|
||
private void close() { | ||
window.close(); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package edu.uco.sdd.rocketdog.model; | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
|
||
import edu.uco.sdd.rocketdog.model.CutSceneStage; | ||
import java.io.File; | ||
import java.util.Timer; | ||
import java.util.TimerTask; | ||
import javafx.scene.media.Media; | ||
import javafx.scene.media.MediaPlayer; | ||
import javafx.scene.media.MediaView; | ||
|
||
/** | ||
* | ||
* @author Sophia | ||
*/ | ||
public class CutScenes extends CutSceneStage { | ||
File file; | ||
String source; | ||
Media media; | ||
MediaPlayer mediaPlayer;// = new MediaPlayer(media); | ||
MediaView mediaView; | ||
Timer timer; | ||
TimerTask task; | ||
|
||
public CutScenes(String url, long delay){ | ||
timer= new Timer(); | ||
task=new TimerTask() { | ||
@Override | ||
public void run() { | ||
timer.cancel(); | ||
timer.purge(); | ||
} | ||
}; | ||
this.setSource(new File(url).toURI().toString()); | ||
this.setMedia(new Media(source)); | ||
this.setMediaPlayer(new MediaPlayer(media)); | ||
mediaPlayer.setAutoPlay(true); | ||
mediaPlayer.setVolume(Double.MAX_VALUE); | ||
this.setMediaView(new MediaView(mediaPlayer)); | ||
timer.schedule(task, delay);// can be changed depending on cutscene lenght | ||
} | ||
|
||
public MediaView getMediaView() { | ||
return mediaView; | ||
} | ||
|
||
public void setMediaView(MediaView mediaView) { | ||
this.mediaView = mediaView; | ||
} | ||
|
||
public File getFile() { | ||
return file; | ||
} | ||
|
||
public void setFile(File file) { | ||
this.file = file; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public void setSource(String s) { | ||
this.source = s; | ||
} | ||
|
||
public Media getMedia() { | ||
return media; | ||
} | ||
|
||
public void setMedia(Media media) { | ||
this.media = media; | ||
} | ||
|
||
public MediaPlayer getMediaPlayer() { | ||
return mediaPlayer; | ||
} | ||
|
||
public void setMediaPlayer(MediaPlayer mediaPlayer) { | ||
this.mediaPlayer = mediaPlayer; | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,75 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package edu.uco.sdd.rocketdog.model; | ||
|
||
import edu.uco.sdd.rocketdog.model.Animations.IAnimateStrategy; | ||
import edu.uco.sdd.rocketdog.model.Animations.SpitzLargeLaserWeaponAnimateStrategy; | ||
import edu.uco.sdd.rocketdog.model.Animations.SpitzLaserWeaponAnimateStrategy; | ||
import javafx.geometry.Point2D; | ||
import javafx.geometry.Rectangle2D; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.image.ImageView; | ||
|
||
public class LargeLaserAttack extends Attack { | ||
/** | ||
* | ||
* @author Kody | ||
*/ | ||
public class LargeLaserAttack extends TangibleEntity implements IAnimateStrategy { | ||
|
||
public LargeLaserAttack(Point2D position, Point2D velocity, boolean isActive) { | ||
super(44, 44, new SpitzLargeLaserWeaponAnimateStrategy()); | ||
super.setPosition(position); | ||
super.setVelocity(velocity); | ||
super.setActive(isActive); | ||
private IAnimateStrategy animating; | ||
|
||
public LargeLaserAttack() { | ||
super(); | ||
super.getHitbox().setVisible(false); | ||
animating = new SpitzLargeLaserWeaponAnimateStrategy(); | ||
setSprite(new ImageView(animating.getImage())); | ||
getSprite().setViewport(animating.getCurrentView()); | ||
setVisableOff(); | ||
} | ||
|
||
public void setAnimation(IAnimateStrategy newAnimation) { | ||
animating = newAnimation; | ||
getSprite().setImage(animating.getImage()); | ||
getSprite().setTranslateX(getPosition().getX()); | ||
getSprite().setTranslateY(getPosition().getY()); | ||
} | ||
|
||
public void update() { | ||
setPosition(new Point2D(getPosition().getX() + getVelocity().getX(), | ||
getPosition().getY() + getVelocity().getY())); | ||
|
||
getSprite().setTranslateX(getPosition().getX()); | ||
getSprite().setTranslateY(getPosition().getY()); | ||
|
||
getHitbox().setTranslateX(getPosition().getX()); | ||
getHitbox().setTranslateY(getPosition().getY()); | ||
|
||
getSprite().setViewport(animating.getCurrentView()); | ||
handle(); // Animations | ||
} | ||
|
||
@Override | ||
public void handle() { | ||
animating.handle(); | ||
} | ||
|
||
@Override | ||
public Rectangle2D getCurrentView() { | ||
return animating.getCurrentView(); | ||
} | ||
|
||
@Override | ||
public Image getImage() { | ||
return animating.getImage(); | ||
} | ||
|
||
public void setVisableOn() { | ||
getSprite().setVisible(true); | ||
} | ||
|
||
public void setVisableOff() { | ||
getSprite().setVisible(false); | ||
} | ||
} |
Oops, something went wrong.