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
#!/usr/bin/env python | |
""" | |
MIT License | |
Copyright 2021 Joe Bentley | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
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
#!/usr/bin/env python | |
""" | |
MIT License | |
Copyright 2020 Joe Bentley | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
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
{ | |
"waves" : [ | |
{ | |
"enemies" : [ | |
{ | |
"type" : "straight", | |
"time" : 1.0, | |
"x" : 100 | |
}, | |
{ |
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
override public function update():void | |
{ | |
/* This is all for the timing of spawns, it checks to see if the elapsed | |
* time is equal to or more than the time when it needs to spawn the entity | |
* (in seconds) and then deletes the entity from the Array */ | |
var time:Number = elapsedFrames / 60; // Game runs at 60 fps, so we divide frames elapsed by 60 to get time in seconds | |
// We use a for loop to avoid compiler warnings about untyped vars... | |
for (var i:int = 0; i <= level.length - 1; i++) |
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
public function LoadLevel():Array | |
{ | |
var array:Array = new Array(); | |
var xml:XML = new XML(LEVEL.data); // We have to call "LEVEL.data" to extract the data right | |
for each (var l:XML in xml.level) | |
{ | |
for each (var e:XML in l.enemy) | |
{ | |
if (e.@type == "straight" || e.@type == "wave") { |