This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f8bc20
commit 8563745
Showing
16 changed files
with
78 additions
and
61 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
### | ||
# This script is responsible for game over menu. | ||
# Author: Breno Viana | ||
# Version: 21/10/2017 | ||
# Version: 16/11/2017 | ||
### | ||
extends Node2D | ||
|
||
func _ready(): | ||
""" Called every time the node is added to the scene. | ||
""" Called every time the node is added to the scene. | ||
Initialization here. """ | ||
# Game settings | ||
Globals.set("paused", false) | ||
# Enemies settings | ||
Globals.set("enemy_group", "enemies") | ||
# Player attributes | ||
Globals.set("score", 0) | ||
Globals.set("number_of_lifes", 3) | ||
Globals.set("amount_of_kunais", 5) | ||
# Game settings | ||
Globals.set("paused", false) | ||
Globals.set("current_level", "w1l1") | ||
# Enemies settings | ||
Globals.set("enemy_group", "enemies") | ||
# Player attributes | ||
Globals.set("score", 0) | ||
Globals.set("number_of_lifes", 3) | ||
Globals.set("amount_of_kunais", 5) |
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 |
---|---|---|
@@ -1,17 +1,18 @@ | ||
### | ||
# This script is responsible for sword behaviors. | ||
# This script is responsible for the completion of levels. | ||
# Author: Breno Viana | ||
# Version: 20/10/2017 | ||
# Version: 16/11/2017 | ||
### | ||
extends Area2D | ||
|
||
func _ready(): | ||
""" Called every time the node is added to the scene. | ||
Initialization here. """ | ||
# Connect behavior when entering the body | ||
connect("body_enter", self, "_on_body_enter") | ||
|
||
func _on_body_enter(body): | ||
""" Called when a body entered the crate. """ | ||
# Check if the ninja enter the crate | ||
# Check if the ninja enter the arrow sign | ||
if(body.get_name() == "ninja"): | ||
get_tree().change_scene("res://scenes/menu/credits.tscn") | ||
get_tree().change_scene("res://scenes/screens/credits.tscn") |
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,55 +1,59 @@ | ||
### | ||
# This script is responsible for kunai behaviors. | ||
# Author: Breno Viana | ||
# Version: 20/10/2017 | ||
# Version: 16/11/2017 | ||
### | ||
extends Area2D | ||
|
||
################################################################################ | ||
|
||
# Kunai damage | ||
var damage | ||
# Kunai movement | ||
var direction | ||
var position | ||
|
||
################################################################################ | ||
|
||
func _ready(): | ||
""" Called every time the node is added to the scene. | ||
Initialization here. """ | ||
damage = 10 | ||
# Initialize values | ||
damage = 10 | ||
# Check direction | ||
if(get_parent().get_node("sprite").is_flipped_h()): | ||
direction = -1 | ||
get_node("sprite").set_flip_v(true) | ||
else: | ||
direction = 1 | ||
# Set direction | ||
if(direction == 1): | ||
direction = 1 | ||
get_node("sprite").set_flip_v(false) | ||
elif(direction == -1): | ||
get_node("sprite").set_flip_v(true) | ||
# Set position | ||
position = get_parent().get_pos() | ||
position = get_parent().get_pos() | ||
position.x += 40 * direction | ||
set_pos(position) | ||
# Set processes | ||
set_fixed_process(true) | ||
# Kunai becomes independent of the ninja | ||
set_as_toplevel(true) | ||
# Connect behavior when entering the body | ||
connect("body_enter", self, "_on_body_enter") | ||
# Set processes | ||
set_fixed_process(true) | ||
|
||
func _fixed_process(delta): | ||
""" Called every frame. """ | ||
# Check if the game is paused | ||
# Check if the game is not paused | ||
if(not Globals.get("paused")): | ||
# Kunai movement | ||
var move = get_pos() | ||
move.x += 10 * direction | ||
move.x += 10 * direction | ||
set_pos(move) | ||
|
||
func _on_body_enter(body): | ||
""" Called when a body entered the crate. """ | ||
# Check if the ninja enter the crate | ||
# Check if the kunai hit a enemy | ||
if(body.is_in_group(Globals.get("enemy_group"))): | ||
# Check if is not dead | ||
# Check if the enemy is not dead | ||
if(not body.dead): | ||
Globals.set("score", Globals.get("score") + body.PONTUATION) | ||
body.dead = true | ||
# Delete kunai | ||
# Delete this kunai | ||
queue_free() |
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 |
---|---|---|
@@ -1,24 +1,30 @@ | ||
### | ||
# This script is responsible for sword behaviors. | ||
# Author: Breno Viana | ||
# Version: 20/10/2017 | ||
# Version: 16/11/2017 | ||
### | ||
extends Area2D | ||
|
||
################################################################################ | ||
|
||
# Sword damage | ||
var damage | ||
|
||
################################################################################ | ||
|
||
func _ready(): | ||
""" Called every time the node is added to the scene. | ||
Initialization here. """ | ||
# Initialize values | ||
damage = 25 | ||
# Connect behavior when entering the body | ||
connect("body_enter", self, "_on_body_enter") | ||
|
||
func _on_body_enter(body): | ||
""" Called when a body entered the crate. """ | ||
# Check if the ninja enter the crate | ||
# Check if the kunai hit a enemy | ||
if(body.is_in_group(Globals.get("enemy_group"))): | ||
# Check if is not dead | ||
# Check if the enemy is not dead | ||
if(not body.dead): | ||
Globals.set("score", Globals.get("score") + body.PONTUATION) | ||
body.dead = true |