I've been thinking of trying to implement Tetris in SC. The hardest part would be rotating the pieces I think, because each piece would be made out of four individual sprites. At least there are only four directions, whereas asteroids has 360 degrees of movement.For asteroids maybe you could just have a bunch of different sprites and show the closest to the current angle. It would look more like the original anyways, because I think that's what they had to do.
You dont need sprites in the same folder as the game? :PYou have to load sprites into the project and give them names.
Anyone have any demos to post? How about source code.I wish I had a better demo, but I've really just been playing around with SCBox2D and trying all the features as they get added. :) I also tried to do stuff I've seen elsewhere, including a very successful chain/rope, a Ship Lander ship and a ball with a mace hanging from it using the chain. (based on http://www.fun-motion.com/physics-games/hammerfall/)
Now that Gan has made some epic progress with his program, what do you think of this game concept:
I was reading in National Geographic about how there's so much junk orbiting around the Earth they are thinking of ways to get rid of it, mostly by pushing it into a decaying orbit where it will disintegrate falling into the atmosphere. So I though I could try to use SCBox2D to make an arcade game where you remote pilot a satellite-robot and push the floating trash to the bottom of the screen and get points. Think Asteroids, except more complicated. The dangers (at least in the arcade game) are: colliding with the trash, accidentally smashing working satellites and possibly even falling to Earth yourself. ;D
Your tools would likely all be for moving things - robot arms, a tether with a magnet, a net and maybe a raygun. Depends what I can make with what I've got to work with. (the tether is the trickiest).\\
i added a map editor in the map method. so laggy! i gotta get an intel!It doesn't lag for me at all.
Oh. I didn't notice the shots not coming out of the gun. I vote that doesn't change. It'd be hard to aim. Are we doing waves or the find-the-goal type game play. If we do a wave type, upgrades and other guns will be important. There's lots of flash games like this. They could help you decide on weapons and such.It'd be trickier but I say find-the-goal is way cooler. You could have a good storyline set up that way too. Gosh I need to find a place that I can try this thing out at full speed.
Definately move this to group projects!
OK here's my epic plot:
A spaceship's crew is overcome with a strange illness, which soon causes irreversible brain damage, those who get it eventually turn on the others and become zombies blah blah blah you have to escape. You find out that many escape pods are damaged or have been taken by crew members who didn't want to wait till they were full (basterds) and you have to find a way off the ship.
It's not too complicated, and we don't have to add much to the engine, just graphics. But I'm sure you could add more wall graphics yeah?
...And if we decide the game needs more added I think there should be a mole on the ship who sabotaged everything on purpose whom you want to find.
So what are you going to do then?? Have each screen be a different level? You can't backtrack and explore around then. But then I guess it's too early to decide exactly what it will do and how.but theres alot more to it, you gotta save all the enemy postitions, enemy types, pickups, keycards, and so on for each room. not to mention it would make level designing much harder. i think the gameplay should be fast paced, and backtracking would just slow down the experience
But here's my two cents: if you use a different card for every room you can set it up however you like and have each card say what rooms it connects to.
hey gan, if you get a licence on the mac app store for a year, can you release as many games as you want within that year with no extra charges? would you want to try to submit gangwars while we work on this game? i went to the gangwars guys house and he doesnt live there anymore so i dont think we would have to worry about royalty fees or anythingYeah, unlimited amount of apps. As for the gangwars, who is this guy? I'd hate to put up a game that isn't fully yours. Well, I could put it up free but we'd have to make sure we're in the clear if it's a paid game.
I like it:THATS cool, we'll definatly use that
Retro Game Title Movie (http://cl.ly/2U1c0i1p0e1D0i2a0a1b)
LET check = (check * -1) + 1
IF check = 1 then UPDATESCREEN
END IF
Does using recreate sprite before updating the screen slow down the game very much?- Connors on animated sprites
What about seeing your own feet move?
Nice sprites, Connors. Either you or Eq can do a boss-sprite. I have some boss-map ideas. Is there a way to have it when the player walks into a certain area, cut to a scene or something. For boss levels, the goal should appear after the boss is dead, along with several powerups. Like in gauntlet.yea that would be easy. post the map then seperately post the lines of the map that are changed, JUST the lines that are changed no need for the whole map
That title screen is made of awesome. I like how you did the floor, is this all Photoshop?oh god yes, photoshop is my jesus
Agreed, that title screen is awesome. The text could be better though, it looks really plain compared to the detailed artwork behind it.yea what font should i use? i messed around with it but i couldnt find one that looked right
LET spawntimer=8 //time between enemy spawning
LET enemylimit=25 //enemies in level
LET maxenemy=12 //maximum amount of enemies on-screen
LET line$(1)= "00010010010901001001000"
LET line$(2)= "0F0R00000100010000000b0"
LET line$(3)= "0001000001h0h1000001000"
LET line$(4)= "11110010011T11001001111"
LET line$(5)= "00000010a01010a01000000"
LET line$(6)= "00000010001010001000000"
LET line$(7)= "00111111011R11011111100"
LET line$(8)= "00160010001010001006100"
LET line$(9)= "0000UhR0A00h00a0RhK0000"
LET line$(10)="00100010x00000x01000100"
LET line$(11)="00111111110001111111100"
LET line$(12)="00000h10000000001h00000"
LET line$(13)="00000010000000001000000"
LET line$(14)="12110010000000001001121"
LET line$(15)="00010000000p00000001A0A"
LET line$(16)="0g02x0000000000000x20d0"
LET line$(17)="00010010000000001001A0A"
LET line$(1)= "00000000000000000000000"
LET line$(2)= "00000000000000000000000"
LET line$(3)= "00000000000000000000000"
LET line$(4)= "00000000000000000000000"
LET line$(5)= "00000000000000000000000"
LET line$(6)= "00000000000000000000000"
LET line$(7)= "00000000000000000000000"
LET line$(8)= "00000000000000000000000"
LET line$(9)= "00000000000000000000000"
LET line$(10)="00000000000000000000000"
LET line$(11)="00000000000000000000000"
LET line$(12)="00000000000000000000000"
LET line$(13)="00000000000000000000000"
LET line$(14)="00000000000000000000000"
LET line$(15)="00000000000000000000000"
LET line$(16)="00000000000000000000000"
LET line$(17)="00000000000000000000000"
p=player spawn point
1=wall //objects
2=false wall
R=red door
T=blue door
9=goal
a=ammo //pick-up items
b=bomb
d=armor
h=health pack
F=rifle
g=boots
L=xtra life
K=red key //keys
U=blue key
x=green zombie //enemies
y=blue zombie
z=red zombie
6=demon
Looks good! And the game is pretty fun. It needs more levels though. You know, if there was a tool that made level-making easier, then people might be more inclined to make them. Hmm...i thought about that, but dude, it couldnt BE easier. you literally just place the digit corrosponding to the item, and thats it. would you consider makeing a level?
Sure, I'll make a level. But I'd like to make a level editor as well. ;D I'm not criticizing the lack of an editor, I'm offering to make one, if that's OK. I don't want to argue, but I think it would be a LOT easier than typing in letters/numbers and trying to imagine what the level looks like.you can make one if you want. when using the source you can test the level as you make it though, you dont have to imagine what it looks like. i did a quick screen cast on how to make levels
The plan here was to work on his armor, extend it to full body armor, give it a head and some arms and bam. He'd be completely 3D. Needs a lot more tweaking but I'm gonna devote more time to the HTML5 GM.it might be easier to have a different still action pic at the end of each episode?
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "000000000000001aKaa1aaa"
LET line$(2) = "00000000000000100001aFa"
LET line$(3) = "000000000000001xxxx1aaa"
LET line$(4) = "111111111110001xxxx1000"
LET line$(5) = "00a00000001111100001000"
LET line$(6) = "0a9a0000001000100001000"
LET line$(7) = "00b000000010p01110111R1"
LET line$(8) = "00000000001000000000000"
LET line$(9) = "000000000011111R1111R11"
LET line$(10) = "00000000001000000010000"
LET line$(11) = "00000000001000000010000"
LET line$(12) = "0000111111100000001hzad"
LET line$(13) = "0000100000T00060001hbag"
LET line$(14) = "00001011111000000011111"
LET line$(15) = "0000T000aL10000000000U1"
LET line$(16) = "00001000aa1111111111111"
LET line$(17) = "00001000aa1000000000000"
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "111111aaaaaaaaaaa111111"
LET line$(2) = "1Lhaaaaaaaaaaaaaaaaahd1"
LET line$(3) = "1haaaaa1aaaa1aaaa1aaah1"
LET line$(4) = "1aaaaaa1aaaa1aaaa1aaaa1"
LET line$(5) = "1aaaaaa1aaaa1aaaa1aaaa1"
LET line$(6) = "aaaaaaaaaaaaaaaaaaaaaaa"
LET line$(7) = "a1111111a1110011a11111a"
LET line$(8) = "aaaaaaaaa1zzzz01aaaaaaa"
LET line$(9) = "1a11111aa1000001a1111a1"
LET line$(10) = "aaaaaaaaa1111111aaaaaaa"
LET line$(11) = "1aaaaaaaaaaaaaaaaaaaaa1"
LET line$(12) = "11a11111111111111111011"
LET line$(13) = "1aaaaaaaaaaapaaaaaaaaa1"
LET line$(14) = "1a1111111111111111111a1"
LET line$(15) = "1b1a1aaa1aaa1aaa1aaa1b1"
LET line$(16) = "1Fbaaa1aaa1aaa1aaa1abg1"
LET line$(17) = "11111111111111111111111"
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "00019000001000100002000"
LET line$(2) = "000111111010d01AKA01aFa"
LET line$(3) = "00L001000010A010Ax01000"
LET line$(4) = "000001060011R11100111R1"
LET line$(5) = "00000100001000100001000"
LET line$(6) = "00000000001000100001000"
LET line$(7) = "121111110010p0000000000"
LET line$(8) = "00000000001000000000000"
LET line$(9) = "000000000A1000000000000"
LET line$(10) = "000111111110x0000011R11"
LET line$(11) = "0002000000T00000001000Y"
LET line$(12) = "0001000000111110011YAg0"
LET line$(13) = "000100000A1000600010Y00"
LET line$(14) = "00010011111000000011211"
LET line$(15) = "000100000A1000000000000"
LET line$(16) = "00000060b020000000000U0"
LET line$(17) = "000000000A1000000000000"
LET spawntimer = 15 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 9 //maximum amount of enemies on-screen
LET line$(1) = "000a0000a0001000a000a00"
LET line$(2) = "00111001111010111101110"
LET line$(3) = "0F11100111101011110111g"
LET line$(4) = "0Y0000000000p00000000Y0"
LET line$(5) = "00111010011111110101110"
LET line$(6) = "h000001000100010010000h"
LET line$(7) = "111110100000R0000101111"
LET line$(8) = "000000000111T1110000000"
LET line$(9) = "00a000100100000101000a0"
LET line$(10) = "11111010h1009001h101111"
LET line$(11) = "00000010011111110100000"
LET line$(12) = "001110000000b0000000110"
LET line$(13) = "U000101101111111011010K"
LET line$(14) = "11001000000010000000101"
LET line$(15) = "0000Z010000010000100Z00"
LET line$(16) = "001111111100Z0011111100"
LET line$(17) = "00000a000000h0000a00000"
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "000000h00000h00000h0000"
LET line$(2) = "00000000000000600000000"
LET line$(3) = "00111100110010001001100"
LET line$(4) = "001a000100101000101dF10"
LET line$(5) = "001a0001g01010101010010"
LET line$(6) = "001110010yR01a1a1010y10"
LET line$(7) = "001a0001011001K10011R10"
LET line$(8) = "00111100111001010010010"
LET line$(9) = "00000006000100000000600"
LET line$(10) = "00000000000000000000000"
LET line$(11) = "00100010011001000010000"
LET line$(12) = "0011001010U100100100000"
LET line$(13) = "001a101010z100011000000"
LET line$(14) = "00101a10Rzz1000110000p0"
LET line$(15) = "0010011010y1001001001T1"
LET line$(16) = "001000100110010y0010T9T"
LET line$(17) = "000000000000000000001T1"
It would be easier AND fit the rest of the artwork better. Gan would have his work cut out for him trying to animate that guy, especially like a killing the boss scene.The plan here was to work on his armor, extend it to full body armor, give it a head and some arms and bam. He'd be completely 3D. Needs a lot more tweaking but I'm gonna devote more time to the HTML5 GM.it might be easier to have a different still action pic at the end of each episode?
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "0001x0x00x11aaaaabdh010"
LET line$(2) = "000100000011aaaaagFh010"
LET line$(3) = "00010000001111111111010"
LET line$(4) = "11110000001100000001010"
LET line$(5) = "00K1T111111100000001010"
LET line$(6) = "0p00aaaaaaTR0600000T0R0"
LET line$(7) = "0001R111111100000001010"
LET line$(8) = "11110000001100000001010"
LET line$(9) = "00010000001100000001010"
LET line$(10) = "090100U0001111111111010"
LET line$(11) = "000100000011aaaaaaaaa10"
LET line$(12) = "00010z0z0z11aaaaaaaaa10"
LET line$(13) = "1T11111111111111111111T"
LET line$(14) = "00000000000000000000000"
LET line$(15) = "06000z00000z00000z00000"
LET line$(16) = "00000000z00000z00000000"
LET line$(17) = "00000000000000000000000"
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 45 //enemies per level
LET maxenemy = 20 //maximum amount of enemies on-screen
LET line$(1) = "11110001001001000200101"
LET line$(2) = "11009000010z000010010h0"
LET line$(3) = "10100000000000000000000"
LET line$(4) = "1U0111x11z1111111z11TT1"
LET line$(5) = "0000001yh100y0000110000"
LET line$(6) = "00z0000x100111000010000"
LET line$(7) = "000a100100100010001001y"
LET line$(8) = "1001a0010y1ap01x00T0001"
LET line$(9) = "1000000R0y10001x00T0000"
LET line$(10) = "1100000R000101000010000"
LET line$(11) = "aF1000010001x0000010110"
LET line$(12) = "00a111100000x000001y0a0"
LET line$(13) = "100R0000010001000001111"
LET line$(14) = "0x110010101010110000000"
LET line$(15) = "111000111z000z001110g01"
LET line$(16) = "110000yTd10aKa01hb0110x"
LET line$(17) = "11010101011111111122221"
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 60 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "9xyzxaaaaaaaaaaaaaxzyx9"
LET line$(2) = "xxyzaa11111111111aazyxx"
LET line$(3) = "yyyaa1000000000001aayyy"
LET line$(4) = "zzaa100000000000001aazz"
LET line$(5) = "xxa10001110001110001axx"
LET line$(6) = "zza1001gbF101Fbg1001azz"
LET line$(7) = "yya1001daaa0aaad1001ayy"
LET line$(8) = "xxa1001Kah101haU1001axx"
LET line$(9) = "6xaT000111000111000Rax6"
LET line$(10) = "xxa10000000000000001axx"
LET line$(11) = "yya1001aa00000aa1001ayy"
LET line$(12) = "zza10001aaaaaaa10001azz"
LET line$(13) = "xxa10000111111100001axx"
LET line$(14) = "zzaa1000000L0000001aazz"
LET line$(15) = "yyyaa1000000000001aayyy"
LET line$(16) = "xxyzaa11111111111aazyxx"
LET line$(17) = "9xyzxaaaaaaaaaaaaaxzyx9"
Looks good Gan. I'm continually amazed by all of the things that you can do with computers. Sometimes I think that you must actually be an advanced AI or something.01010100011010000110000101101110-erm, I mean thanks.
Gan would have his work cut out for him trying to animate that guy, especially like a killing the boss scene.I'm thinking animation wouldn't be so hard, worst part is actually modeling it. After I model it, I just set the bone structure of the model and then position the bones to animate. That's actually one of the easier parts. Just gotta... make it.
Way cool level editor.Thanks Gan. :D
What do you think? Any constructive criticism? Is it hard enough?this is a good level, i just had to make a few adjustments cause it was running at 2-3 frames per second for me. so i reduced the on screen enemies to 15 from 20 and took out about 30 blocks that werent needed. try not to wall off edges of the map cause thats where enemies respawn and also the edge of the screen is a wall anyway
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 15 //maximum amount of enemies on-screen
LET line$(1) = "00000000001000000000000"
LET line$(2) = "000090000001000010000h0"
LET line$(3) = "01100000000000000100000"
LET line$(4) = "1U011101101111111011TT1"
LET line$(5) = "00000010h100y0000110000"
LET line$(6) = "00z00000100111000010000"
LET line$(7) = "000a1001001000100010010"
LET line$(8) = "0001a0010y1ap01000T0000"
LET line$(9) = "0000000R0y10001000T0000"
LET line$(10) = "1100000R000101000010000"
LET line$(11) = "aF100001000100000010110"
LET line$(12) = "000111100000xx00001y0a0"
LET line$(13) = "000R0000010001000001111"
LET line$(14) = "11110010101010110000000"
LET line$(15) = "001000111z000z001110g01"
LET line$(16) = "A00000yTd10aKa01hb01100"
LET line$(17) = "00100001010000010000021"
i was thinking maybe we should have the enemies spawn anywhere on the map?OK, seriously listen, I've already had enemies spawn right on top of me when I was too close to the edge and it's been a constant thing with this game... Having them spawn randomly anywhere would just be horrifying. XD I think we should just rewrite some of the spawn code to randomly pick only non-blocked squares. It would pick a random number from 1 to the number of open squares on the edge. Then it would use a FOR loop to go around the edge until it got to that number of open squares, and place the enemy. That way it picks a random open square and they always get into the level... AND you could control what rooms they can get into. Also if a room has more open walls more zombies tend to show up there.
LET spawntimer = 5 //time between enemy spawning
LET enemylimit = 30 //enemies per level
LET maxenemy = 10 //maximum amount of enemies on-screen
LET line$(1) = "00000011111111111100000"
LET line$(2) = "000000000000p0000000000"
LET line$(3) = "00000011111111111100000"
LET line$(4) = "00K0001aaa0090aaa100U00"
LET line$(5) = "a0000a100000b00001a000a"
LET line$(6) = "1R1111111111T1111111T11"
LET line$(7) = "0000001d00000000b100000"
LET line$(8) = "00000010000000000100000"
LET line$(9) = "0a000010000060000100a00"
LET line$(10) = "0a000010000000000100a00"
LET line$(11) = "000z00100000000001000y0"
LET line$(12) = "00000010000000000100000"
LET line$(13) = "1R1111111111T1111111T11"
LET line$(14) = "0000001aaaa1R1aaa100000"
LET line$(15) = "0000001hg000L00Fh100000"
LET line$(16) = "000y00T0000000000R00z00"
LET line$(17) = "00000011111111111100000"
["1.0","156","Space Marine","1024","768",true,[{"name":"Main","methods":[{"name":"Global Variables","code":"//Declare variables here. They can be used anywhere in this class if declared here.\n\n//Set the current level to null\nvar level = null\nvar gameProgress = 0\n\n\n//Set the intro to 0 so it begins\nvar introStage = 0 //0 is Loading, 1 is Computer screen, 2 is Title Screen\nvar introCount = 0\n//Make a timer to run the intro\nvar introTimer = new Timer(\"RunIntro()\", 1.0/60.0)\n\n\n\nvar MainMenu = 0\nvar GameScreen = 1\n\nvar currentScreen = MainMenu","special":1,"parameters":""},{"name":"Game Open","code":"//This activates when your game starts. Remember! All commands and variables are case sensitive.\n\n//Load all the stuff\nLoadImage(\"Computer\")\nLoadImage(\"Title\")\nLoadImage(\"Sprites\")\nLoadImage(\"Button\")\nLoadSound(\"Item\")\nLoadSound(\"Ammo\")\nLoadSound(\"Shoot\")\nLoadSound(\"Door\")\nLoadSound(\"Health\")\nLoadSound(\"Shoot2\")\nLoadSound(\"Dead\")\nLoadSound(\"Bomb\")\nLoadSound(\"Teleport\")\nLoadSound(\"Gameover\")","special":2,"parameters":""},{"name":"Key Down","code":"//This is triggered when a key is pressed.","special":3,"parameters":""},{"name":"Key Up","code":"//This is triggered when a key is let go.","special":4,"parameters":""},{"name":"Mouse Down","code":"//This is triggered when the mouse is pressed.","special":5,"parameters":""},{"name":"Mouse Up","code":"//This is triggered when the mouse is let go.\nif currentScreen = MainMenu Then\n if introStage = 1 Then\n introStage = 2\n introCount = 0\n else if introStage = 2 Then\n if MouseX() >= 456 and MouseX() <= 568 and MouseY() >= 475 and MouseY() <= 525 Then\n if currentScreen = MainMenu Then\n introTimer.Stop()\n introCount = 0\n End If\n\n LoadLevel()\n End If\n End If\nEnd If","special":6,"parameters":""},{"name":"Mouse Move","code":"//This is triggered when the mouse moves.","special":7,"parameters":""},{"name":"Game Close","code":"//This activates when your game closes.","special":8,"parameters":""},{"name":"RunIntro","code":"//Count will increase 60 frames per second\nClearScreen()\nif introStage = 0 Then\n var progress = 0\n var progressMax = 14\n if ImageIsLoaded(\"Computer\") Then\n progress += 1\n End If\n if ImageIsLoaded(\"Title\") Then\n progress += 1\n End If\n if ImageIsLoaded(\"Sprites\") Then\n progress += 1\n End If\n if ImageIsLoaded(\"Button\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Item\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Ammo\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Shoot\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Door\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Health\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Shoot2\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Dead\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Bomb\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Teleport\") Then\n progress += 1\n End If\n if SoundIsLoaded(\"Gameover\") Then\n progress += 1\n End If\n //Draw Background\n SetFillColor(\"Black\")\n FillRect(0,0,1024,768)\n //Draw Text\n SetFillColor(\"White\")\n context.font = \"60pt Calibri\";\n SetStringAlign(\"center\")\n DrawString(\"Loading...\", 512, 300)\n //Draw Loading Bar\n SetFillColor(\"Red\")\n FillRect(100,668,824*progress/progressMax,40)\n SetStrokeColor(\"Silver\")\n DrawRect(100,668,824,40)\n if progress = progressMax Then\n If introCount >= 40 Then\n introStage = 1\n introCount = 0\n End If\n else\n introCount = 0\n End If\nEnd If\nif introStage = 1 Then\n //Draw the computer\n SetImageDrawOrigin(0,0)\n DrawImage(\"Computer\",0,0)\n if introCount >= 0 Then\n SetFillColor(\"rgb(0,255,0)\")\n context.font = \"15pt Calibri\";\n SetStringAlign(\"left\")\n DrawString(\"/STARTUP.TRNS\", 260, 180)\n End If\n if introCount >= 60 Then\n var text = \"\"\n if introCount >= 100 Then\n text += \".\"\n End If\n if introCount >= 140 Then\n text += \".\"\n End If\n if introCount >= 180 Then\n text += \".\"\n End If\n if introCount >= 220 Then\n text += \".\"\n End If\n if introCount >= 260 Then\n text += \".\"\n End If\n DrawString(text, 260, 200)\n End If\n if introCount >= 300 Then\n SetFillColor(\"rgb(255,0,0)\")\n DrawString(\"_WARNING_\", 260, 220)\n End If\n if introCount >= 320 Then\n DrawString(\"DOWNLOADING DATA...\", 260, 240)\n End If\n if introCount >= 360 Then\n DrawString(\"INCOMING TRANSMISSION...\", 260, 260)\n End If\n if introCount >= 400 Then\n DrawString(\"'SPACE STATION EQWANOX HAS BEEN SEVERELY DAMAGED\", 260, 300)\n DrawString(\"IN NEED OF EMERGENCY EVAC.'\", 260, 320)\n End If\n if introCount >= 550 Then\n DrawString(\"SENT AT 5:47 4/5/2130\", 260, 340)\n End If\n if introCount >= 700 Then\n var color = ((100-(800-introCount))/100)\n SetFillColor(\"rgba(0,0,0,\"+color+\")\")\n FillRect(0,0,1024,768)\n End If\n if introCount >= 800 Then\n introStage += 1\n introCount = 0\n End If\nEnd If\nif introStage = 2 Then\n //Draw Title Screen With Button\n SetImageDrawOrigin(0,0)\n DrawImage(\"Title\",0,0)\n SetImageDrawOrigin(0.5,0.5)\n DrawImage(\"Button\",512,500)\n SetFillColor(\"White\")\n context.font = \"20pt Calibri\";\n SetStringAlign(\"center\")\n DrawString(\"Play\", 512, 510)\n\n if introCount <= 100 Then\n var color = ((100-introCount)/100)\n SetFillColor(\"rgba(0,0,0,\"+color+\")\")\n FillRect(0,0,1024,768)\n End If\n if introCount >= 101 Then\n introTimer.Stop()\n introCount = 0\n End If\nEnd If\nintroCount += 1","special":0,"parameters":""},{"name":"LoadLevel","code":"currentScreen = GameScreen\nif gameProgress = 0 Then\n //Create a new level using the level 1 data\n var spawntimer = 5 //time between enemy spawning\n var enemylimit = 60 //enemies per level\n var maxenemy = 10 //maximum amount of enemies on-screen\n var grid = new Array()\n grid[0] = \"9xyzxaaaaaaaaaaaaaxzyx9\"\n grid[1] = \"xxyzaa11111111111aazyxx\"\n grid[2] = \"yyyaa1000000000001aayyy\"\n grid[3] = \"zzaa100000000000001aazz\"\n grid[4] = \"xxa10001110001110001axx\"\n grid[5] = \"zza1001gbF101Fbg1001azz\"\n grid[6] = \"yya1001daaa0aaad1001ayy\"\n grid[7] = \"xxa1001Kah101haU1001axx\"\n grid[8] = \"6xaT000111000111000Rax6\"\n grid[9] = \"xxa10000000000000001axx\"\n grid[10] = \"yya1001aa00000aa1001ayy\"\n grid[11] = \"zza10001aaaaaaa10001azz\"\n grid[12] = \"xxa10000111111100001axx\"\n grid[13] = \"zzaa1000000p0000001aazz\"\n grid[14] = \"yyyaa1000000000001aayyy\"\n grid[15] = \"xxyzaa11111111111aazyxx\"\n grid[16] = \"9xyzxaaaaaaaaaaaaaxzyx9\"\n\n level = new Level(spawntimer, enemylimit, maxenemy, grid)\nEnd If","special":0,"parameters":""}],"permanent":true,"special":1},{"name":"Level","methods":[{"name":"On Construction","code":"this.badGuys = new Array()\n\nthis.player = new Character(this, \"player\")\n\nthis.spawnTimer = spawntimer\nthis.enemyLimit = enemylimit\nthis.maxEnemy = maxenemy\n\n//Now cycle through the grid and put it into 2D array form - Width 23, Height 17\nthis.grid = new Array()\nfor x = 0 to 22\n this.grid[x] = new Array()\n for y = 0 to 16\n this.grid[x][y] = grid[y].charAt(x)\n next\nnext\n\n\n//Go through grid and determine player location, create baddies\nfor x = 0 to 22\n for y = 0 to 16\n if this.grid[x][y] = \"p\" Then\n this.player.x = x*44+22\n this.player.y = y*44+22\n End If\n if this.grid[x][y] = \"x\" Then\n var c = new Character(this, \"green\")\n c.x = x*44+22\n c.y = y*44+22\n this.badGuys.push(c)\n End If\n if this.grid[x][y] = \"y\" Then\n var c = new Character(this, \"blue\")\n c.x = x*44+22\n c.y = y*44+22\n this.badGuys.push(c)\n End If\n if this.grid[x][y] = \"z\" Then\n var c = new Character(this, \"red\")\n c.x = x*44+22\n c.y = y*44+22\n this.badGuys.push(c)\n End If\n if this.grid[x][y] = \"6\" Then\n var c = new Character(this, \"boss\")\n c.x = x*44+22\n c.y = y*44+22\n this.badGuys.push(c)\n End If\n next\nnext\n\n//Now set up the logic and draw timer\nthis.timer = new Timer(\"LogicAndDraw()\", 1.0/30.0, this)","special":1,"parameters":"spawntimer, enemylimit, maxenemy, grid"},{"name":"LogicAndDraw","code":"//Logic\n\n//Move player\nvar moveX = 0\nvar moveY = 0\nIf KeyIsPressed(37) Then\n moveX -= 1\nEnd If\nIf KeyIsPressed(39) Then\n moveX += 1\nEnd If\nIf KeyIsPressed(38) Then\n moveY -= 1\nEnd If\nIf KeyIsPressed(40) Then\n moveY += 1\nEnd If\nthis.player.Run(moveX, moveY)\n\n//Move all the characters\nfor i = 0 to this.badGuys.length-1\n this.badGuys[i].RunAI()\nnext\n\n//Draw\nClearScreen()\n\n//Now loop through all the tiles and draw them\nSetImageDrawOrigin(0,0)\n for x = 0 to 22\n for y = 0 to 16\n if this.grid[x][y] = \"1\" Then\n DrawImageSection(\"Sprites\", 220, 110, 44, 44, x*44, y*44, 44, 44, 0)\n else\n DrawImageSection(\"Sprites\", 220, 0, 44, 44, x*44, y*44, 44, 44, 0)\n End If\n next\n next\n\n//Draw player\nthis.player.Draw()\n\n//Draw the baddies\nfor i = 0 to this.badGuys.length - 1\n this.badGuys[i].Draw()\nnext","special":0,"parameters":""}],"permanent":false,"special":0},{"name":"Character","methods":[{"name":"On Construction","code":"this.type = type\nif type = \"player\" Then\n this.health = 100\n this.maxHealth = 100\n this.x = 0\n this.y = 0\n this.direction = \"down\"\n this.speed = 13/5\n this.spriteSheetX = 0\n this.spriteSheetY = 0\n this.spriteSheetWidth = 55\n this.spriteSheetHeight = 55\nEnd If\nif type = \"green\" Then\n this.health = 100\n this.maxHealth = 100\n this.x = 0\n this.y = 0\n this.direction = \"down\"\n this.speed = 5/5\n this.spriteSheetX = 330\n this.spriteSheetY = 0\n this.spriteSheetWidth = 55\n this.spriteSheetHeight = 55\nEnd If\nif type = \"blue\" Then\n this.health = 100\n this.maxHealth = 100\n this.x = 0\n this.y = 0\n this.direction = \"down\"\n this.speed = 8/5\n this.spriteSheetX = 385\n this.spriteSheetY = 0\n this.spriteSheetWidth = 55\n this.spriteSheetHeight = 55\nEnd If\nif type = \"red\" Then\n this.health = 100\n this.maxHealth = 100\n this.x = 0\n this.y = 0\n this.direction = \"down\"\n this.speed = 12/5\n this.spriteSheetX = 440\n this.spriteSheetY = 0\n this.spriteSheetWidth = 55\n this.spriteSheetHeight = 55\nEnd If\nif type = \"boss\" Then\n this.health = 100\n this.maxHealth = 100\n this.x = 0\n this.y = 0\n this.direction = \"down\"\n this.speed = 8/5\n this.spriteSheetX = 495\n this.spriteSheetY = 0\n this.spriteSheetWidth = 110\n this.spriteSheetHeight = 110\nEnd If\n\n\nthis.level = level","special":1,"parameters":"level, type"},{"name":"Draw","code":"IF this.direction=\"up\" then this.rotation=180\nIF this.direction=\"down\" then this.rotation=0\nIF this.direction=\"left\" then this.rotation=90\nIF this.direction=\"right\" then this.rotation=270\nIF this.direction=\"leftup\" then this.rotation=180-45\nIF this.direction=\"rightup\" then this.rotation=180+45\nIF this.direction=\"leftdown\" then this.rotation=45\nIF this.direction=\"rightdown\" then this.rotation=-45\n\nSetImageDrawOrigin(0.5,0.5)\nDrawImageSection(\"Sprites\", this.spriteSheetX, this.spriteSheetY, this.spriteSheetWidth,this.spriteSheetHeight, this.x, this.y, this.spriteSheetWidth, this.spriteSheetHeight, this.rotation)","special":0,"parameters":""},{"name":"Run","code":"//Do collision code here\n\nif moveX = 1 Then this.direction = \"right\"\nif moveX = -1 Then this.direction = \"left\"\nif moveY = 1 Then this.direction = \"down\"\nif moveY = -1 Then this.direction = \"up\"\n\nif moveY = 1 and moveX = 1 Then this.direction = \"rightdown\"\nif moveY = -1 and moveX = 1 Then this.direction = \"rightup\"\nif moveY = 1 and moveX = -1 Then this.direction = \"leftdown\"\nif moveY = -1 and moveX = -1 Then this.direction = \"leftup\"\n\n//Get the player's approximate new tile\nvar newX = (this.x + moveX*this.speed)\nvar newY = (this.y + moveY*this.speed)\nvar tileX = Round(newX/44)\nvar tileY = Round(newY/44)\n\n//Now loop through a 3x3 tile radius with the player's tile in the middle and detect if the player's too close\nfor x = tileX - 1 to tileX + 1\n for y = tileY - 1 to tileY + 1\n if x >= 0 and y >= 0 and x < 23 and y < 23 and level.grid[x][y] = \"1\" Then\n var padX = this.spriteSheetWidth-15\n var padY = this.spriteSheetHeight-15\n var lb = (x*44+22)-padX, rb = (x*44+22)+padY, ub = (y*44+22)-padX, db = (y*44+22)+padY\n if newX > lb and newX < rb and newY > ub and newY < db Then\n if newX > lb and newX < rb and this.y > ub and this.y < db Then \n moveX = 0\n end if\n if newY > ub and newY < db and this.x > lb and this.x < rb Then\n moveY = 0\n End If\n End If\n End If\n next\nnext\nif newX < 22 Then newX = 22\nif newY < 22 Then newY = 22\nif newX > 23*44-22 Then newX = 23*44-22\nif newY > 15*44-22 Then newY = 15*44-22\nif moveX != 0 Then this.x = newX\nif moveY != 0 Then this.y = newY","special":0,"parameters":"moveX, moveY"},{"name":"RunAI","code":"var moveX = 0\nvar moveY = 0\nif level.player.x < this.x-10 Then moveX = -1\nif level.player.x > this.x+10 Then moveX = 1\nif level.player.y < this.y-10 Then moveY = -1\nif level.player.y > this.y+10 Then moveY = 1\nthis.Run(moveX, moveY)","special":0,"parameters":""}],"permanent":false,"special":0}],[{"name":"Button","source":"http://www.gamemakersgarage.com/RetroGame/button.jpg","isImage":true},{"name":"Computer","source":"http://www.gamemakersgarage.com/RetroGame/compter.jpg","isImage":true},{"name":"Sprites","source":"http://www.gamemakersgarage.com/RetroGame/sprites.png","isImage":true},{"name":"Title","source":"http://www.gamemakersgarage.com/RetroGame/title.jpg","isImage":true},{"name":"Item","source":"http://www.gamemakersgarage.com/RetroGame/item.mp3","isImage":false},{"name":"Ammo","source":"http://www.gamemakersgarage.com/RetroGame/ammo.mp3","isImage":false},{"name":"Shoot","source":"http://www.gamemakersgarage.com/RetroGame/shoot.mp3","isImage":false},{"name":"Door","source":"http://www.gamemakersgarage.com/RetroGame/door.mp3","isImage":false},{"name":"Health","source":"http://www.gamemakersgarage.com/RetroGame/health.mp3","isImage":false},{"name":"Shoot2","source":"http://www.gamemakersgarage.com/RetroGame/shoot2.mp3","isImage":false},{"name":"Dead","source":"http://www.gamemakersgarage.com/RetroGame/dead.mp3","isImage":false},{"name":"Bomb","source":"http://www.gamemakersgarage.com/RetroGame/bomb.mp3","isImage":false},{"name":"Teleport","source":"http://www.gamemakersgarage.com/RetroGame/teleport.mp3","isImage":false},{"name":"Gameover","source":"http://www.gamemakersgarage.com/RetroGame/gameover.mp3","isImage":false}]]
<script src='http://www.gamemakersgarage.com/html5/jquery.min.js'></script>
<script src='http://www.gamemakersgarage.com/html5/HTML5-Commands.js'></script>
<div style='text-align:center;'>
<div id='holder' style='width:100%;height:100%'>
<canvas id='gameCanvas' width='1024' height='768' style='cursor:default;outline: none;position:relative;margin:0;padding:0px;top:0px;background:transparent;'></canvas>
</div>
</div><script type='text/javascript'>
var errorLoc = 'Critical error- unable to parse and inject Javascript, check your End IFs and Next end tags. Probably missing one.';
window.onerror=function(msg, url, line){
reportError('An error has occurred! \nMessage: ' + msg + ' \nLocation: ' + line);
return true;
}
</script><script type='text/javascript'>
var canvas = document.getElementById('gameCanvas');
var context = canvas.getContext('2d');
prepareCommands();
var imageArray = new Array();
imageArray["Button"]= "http://www.gamemakersgarage.com/RetroGame/button.jpg";
imageArray["Computer"]= "http://www.gamemakersgarage.com/RetroGame/compter.jpg";
imageArray["Sprites"]= "http://www.gamemakersgarage.com/RetroGame/sprites.png";
imageArray["Title"]= "http://www.gamemakersgarage.com/RetroGame/title.jpg";
var soundArray = new Array()
soundArray["Item"]= "http://www.gamemakersgarage.com/RetroGame/item.mp3";
soundArray["Ammo"]= "http://www.gamemakersgarage.com/RetroGame/ammo.mp3";
soundArray["Shoot"]= "http://www.gamemakersgarage.com/RetroGame/shoot.mp3";
soundArray["Door"]= "http://www.gamemakersgarage.com/RetroGame/door.mp3";
soundArray["Health"]= "http://www.gamemakersgarage.com/RetroGame/health.mp3";
soundArray["Shoot2"]= "http://www.gamemakersgarage.com/RetroGame/shoot2.mp3";
soundArray["Dead"]= "http://www.gamemakersgarage.com/RetroGame/dead.mp3";
soundArray["Bomb"]= "http://www.gamemakersgarage.com/RetroGame/bomb.mp3";
soundArray["Teleport"]= "http://www.gamemakersgarage.com/RetroGame/teleport.mp3";
soundArray["Gameover"]= "http://www.gamemakersgarage.com/RetroGame/gameover.mp3";
var mousePressed= false;
var lastKeyPressed = null;
var keyPressedArray = new Array();
for (i = 0; i < 300; i++) {keyPressedArray.push(false);}var mouseX = 0;
var mouseY = 0;
var level = null;
var gameProgress = 0;
var introStage = 0;
var introCount = 0;
var introTimer = new Timer("RunIntro()", 1.0/60.0);
var MainMenu = 0;
var GameScreen = 1;
var currentScreen = MainMenu;
function Game_Open() {
LoadImage("Computer");
LoadImage("Title");
LoadImage("Sprites");
LoadImage("Button");
LoadSound("Item");
LoadSound("Ammo");
LoadSound("Shoot");
LoadSound("Door");
LoadSound("Health");
LoadSound("Shoot2");
LoadSound("Dead");
LoadSound("Bomb");
LoadSound("Teleport");
LoadSound("Gameover");
}
function Key_Down() {
}
function Key_Up() {
}
function Mouse_Down() {
}
function Mouse_Up() {
if ( currentScreen == MainMenu ) {
if ( introStage == 1 ) {
introStage = 2;
introCount = 0;
} else if ( introStage == 2 ) {
if ( MouseX() >= 456 && MouseX() <= 568 && MouseY() >= 475 && MouseY() <= 525 ) {
if ( currentScreen == MainMenu ) {
introTimer.Stop();
introCount = 0;
}
LoadLevel();
}
}
}
}
function Mouse_Move() {
}
function Game_Close() {
}
function RunIntro() {
ClearScreen();
if ( introStage == 0 ) {
var progress = 0;
var progressMax = 14;
if ( ImageIsLoaded("Computer") ) {
progress += 1;
}
if ( ImageIsLoaded("Title") ) {
progress += 1;
}
if ( ImageIsLoaded("Sprites") ) {
progress += 1;
}
if ( ImageIsLoaded("Button") ) {
progress += 1;
}
if ( SoundIsLoaded("Item") ) {
progress += 1;
}
if ( SoundIsLoaded("Ammo") ) {
progress += 1;
}
if ( SoundIsLoaded("Shoot") ) {
progress += 1;
}
if ( SoundIsLoaded("Door") ) {
progress += 1;
}
if ( SoundIsLoaded("Health") ) {
progress += 1;
}
if ( SoundIsLoaded("Shoot2") ) {
progress += 1;
}
if ( SoundIsLoaded("Dead") ) {
progress += 1;
}
if ( SoundIsLoaded("Bomb") ) {
progress += 1;
}
if ( SoundIsLoaded("Teleport") ) {
progress += 1;
}
if ( SoundIsLoaded("Gameover") ) {
progress += 1;
}
SetFillColor("Black");
FillRect(0,0,1024,768);
SetFillColor("White");
context.font = "60pt Calibri";
SetStringAlign("center");
DrawString("Loading...", 512, 300);
SetFillColor("Red");
FillRect(100,668,824*progress/progressMax,40);
SetStrokeColor("Silver");
DrawRect(100,668,824,40);
if ( progress == progressMax ) {
if ( introCount >= 40 ) {
introStage = 1;
introCount = 0;
}
} else {
introCount = 0;
}
}
if ( introStage == 1 ) {
SetImageDrawOrigin(0,0);
DrawImage("Computer",0,0);
if ( introCount >= 0 ) {
SetFillColor("rgb(0,255,0)");
context.font = "15pt Calibri";
SetStringAlign("left");
DrawString("/STARTUP.TRNS", 260, 180);
}
if ( introCount >= 60 ) {
var text = "";
if ( introCount >= 100 ) {
text += ".";
}
if ( introCount >= 140 ) {
text += ".";
}
if ( introCount >= 180 ) {
text += ".";
}
if ( introCount >= 220 ) {
text += ".";
}
if ( introCount >= 260 ) {
text += ".";
}
DrawString(text, 260, 200);
}
if ( introCount >= 300 ) {
SetFillColor("rgb(255,0,0)");
DrawString("_WARNING_", 260, 220);
}
if ( introCount >= 320 ) {
DrawString("DOWNLOADING DATA...", 260, 240);
}
if ( introCount >= 360 ) {
DrawString("INCOMING TRANSMISSION...", 260, 260);
}
if ( introCount >= 400 ) {
DrawString("'SPACE STATION EQWANOX HAS BEEN SEVERELY DAMAGED", 260, 300);
DrawString("IN NEED OF EMERGENCY EVAC.'", 260, 320);
}
if ( introCount >= 550 ) {
DrawString("SENT AT 5:47 4/5/2130", 260, 340);
}
if ( introCount >= 700 ) {
var color = ((100-(800-introCount))/100);
SetFillColor("rgba(0,0,0,"+color+")");
FillRect(0,0,1024,768);
}
if ( introCount >= 800 ) {
introStage += 1;
introCount = 0;
}
}
if ( introStage == 2 ) {
SetImageDrawOrigin(0,0);
DrawImage("Title",0,0);
SetImageDrawOrigin(0.5,0.5);
DrawImage("Button",512,500);
SetFillColor("White");
context.font = "20pt Calibri";
SetStringAlign("center");
DrawString("Play", 512, 510);
if ( introCount <= 100 ) {
var color = ((100-introCount)/100);
SetFillColor("rgba(0,0,0,"+color+")");
FillRect(0,0,1024,768);
}
if ( introCount >= 101 ) {
introTimer.Stop();
introCount = 0;
}
}
introCount += 1;
}
function LoadLevel() {
currentScreen = GameScreen;
if ( gameProgress == 0 ) {
var spawntimer = 5;
var enemylimit = 60;
var maxenemy = 10;
var grid = new Array();
grid[0] = "9xyzxaaaaaaaaaaaaaxzyx9";
grid[1] = "xxyzaa11111111111aazyxx";
grid[2] = "yyyaa1000000000001aayyy";
grid[3] = "zzaa100000000000001aazz";
grid[4] = "xxa10001110001110001axx";
grid[5] = "zza1001gbF101Fbg1001azz";
grid[6] = "yya1001daaa0aaad1001ayy";
grid[7] = "xxa1001Kah101haU1001axx";
grid[8] = "6xaT000111000111000Rax6";
grid[9] = "xxa10000000000000001axx";
grid[10] = "yya1001aa00000aa1001ayy";
grid[11] = "zza10001aaaaaaa10001azz";
grid[12] = "xxa10000111111100001axx";
grid[13] = "zzaa1000000p0000001aazz";
grid[14] = "yyyaa1000000000001aayyy";
grid[15] = "xxyzaa11111111111aazyxx";
grid[16] = "9xyzxaaaaaaaaaaaaaxzyx9";
level = new Level(spawntimer, enemylimit, maxenemy, grid);
}
}
function Level(spawntimer, enemylimit, maxenemy, grid) {
this.LogicAndDraw= function() {
var moveX = 0;
var moveY = 0;
var speed = 3;
if ( KeyIsPressed(37) ) {
moveX -= speed;
}
if ( KeyIsPressed(39) ) {
moveX += speed;
}
if ( KeyIsPressed(38) ) {
moveY -= speed;
}
if ( KeyIsPressed(40) ) {
moveY += speed;
}
this.player.Run(moveX, moveY);
for ( var i = 0 ; i <= this.badGuys.length-1; i ++) {
this.badGuys[i].RunAI();
}
ClearScreen();
SetImageDrawOrigin(0,0);
for ( var x = 0 ; x <= 22; x ++) {
for ( var y = 0 ; y <= 16; y ++) {
if ( this.grid[x][y] == "1" ) {
DrawImageSection("Sprites", 220, 110, 44, 44, x*44, y*44, 44, 44, 0);
} else {
DrawImageSection("Sprites", 220, 0, 44, 44, x*44, y*44, 44, 44, 0);
}
}
}
this.player.Draw();
for ( var i = 0 ; i <= this.badGuys.length - 1; i ++) {
this.badGuys[i].Draw();
}
}
this.badGuys = new Array();
this.player = new Character(this, "player");
this.spawnTimer = spawntimer;
this.enemyLimit = enemylimit;
this.maxEnemy = maxenemy;
this.grid = new Array();
for ( var x = 0 ; x <= 22; x ++) {
this.grid[x] = new Array();
for ( var y = 0 ; y <= 16; y ++) {
this.grid[x][y] = grid[y].charAt(x);
}
}
for ( var x = 0 ; x <= 22; x ++) {
for ( var y = 0 ; y <= 16; y ++) {
if ( this.grid[x][y] == "p" ) {
this.player.x = x*44+22;
this.player.y = y*44+22;
}
if ( this.grid[x][y] == "x" ) {
var c = new Character(this, "green");
c.x = x*44+22;
c.y = y*44+22;
this.badGuys.push(c);
}
if ( this.grid[x][y] == "y" ) {
var c = new Character(this, "blue");
c.x = x*44+22;
c.y = y*44+22;
this.badGuys.push(c);
}
if ( this.grid[x][y] == "z" ) {
var c = new Character(this, "red");
c.x = x*44+22;
c.y = y*44+22;
this.badGuys.push(c);
}
if ( this.grid[x][y] == "6" ) {
var c = new Character(this, "boss");
c.x = x*44+22;
c.y = y*44+22;
this.badGuys.push(c);
}
}
}
this.timer = new Timer("LogicAndDraw()", 1.0/30.0, this);
}
function Character(level, type) {
this.Draw= function() {
if ( this.direction=="up" ) this.rotation=180;
if ( this.direction=="down" ) this.rotation=0;
if ( this.direction=="left" ) this.rotation=90;
if ( this.direction=="right" ) this.rotation=270;
if ( this.direction=="leftup" ) this.rotation=180-45;
if ( this.direction=="rightup" ) this.rotation=180+45;
if ( this.direction=="leftdown" ) this.rotation=45;
if ( this.direction=="rightdown" ) this.rotation=-45;
SetImageDrawOrigin(0.5,0.5);
DrawImageSection("Sprites", this.spriteSheetX, this.spriteSheetY, this.spriteSheetWidth,this.spriteSheetHeight, this.x, this.y, this.spriteSheetWidth, this.spriteSheetHeight, this.rotation);
}
this.Run= function(moveX, moveY) {
if ( moveX > 0 ) this.direction = "right";
if ( moveX < 0 ) this.direction = "left";
if ( moveY > 0 ) this.direction = "down";
if ( moveY < 0 ) this.direction = "up";
if ( moveY > 0 && moveX > 0 ) this.direction = "rightdown";
if ( moveY < 0 && moveX > 0 ) this.direction = "rightup";
if ( moveY > 0 && moveX < 0 ) this.direction = "leftdown";
if ( moveY < 0 && moveX < 0 ) this.direction = "leftup";
var newX = (this.x + moveX*this.speed);
var newY = (this.y + moveY*this.speed);
var tileX = Round(newX/44);
var tileY = Round(newY/44);
for ( var x = tileX - 1 ; x <= tileX + 1; x ++) {
for ( var y = tileY - 1 ; y <= tileY + 1; y ++) {
if ( x >= 0 && y >= 0 && x < 23 && y < 23 && level.grid[x][y] == "1" ) {
var padX = this.spriteSheetWidth-15;
var padY = this.spriteSheetHeight-15;
var lb = (x*44+22)-padX, rb = (x*44+22)+padY, ub = (y*44+22)-padX, db = (y*44+22)+padY;
if ( newX > lb && newX < rb && newY > ub && newY < db ) {
if ( newX > lb && newX < rb && this.y > ub && this.y < db ) {
moveX = 0;
}
if ( newY > ub && newY < db && this.x > lb && this.x < rb ) {
moveY = 0;
}
}
}
}
}
if ( newX < 22 ) newX = 22;
if ( newY < 22 ) newY = 22;
if ( newX > 23*44-22 ) newX = 23*44-22;
if ( newY > 15*44-22 ) newY = 15*44-22;
if ( moveX != 0 ) this.x = newX;
if ( moveY != 0 ) this.y = newY;
}
this.RunAI= function() {
var moveX = 0;
var moveY = 0;
if ( level.player.x < this.x-10 ) moveX = -1;
if ( level.player.x > this.x+10 ) moveX = 1;
if ( level.player.y < this.y-10 ) moveY = -1;
if ( level.player.y > this.y+10 ) moveY = 1;
this.Run(moveX, moveY);
}
this.type = type;
if ( type == "player" ) {
this.health = 100;
this.maxHealth = 100;
this.x = 0;
this.y = 0;
this.direction = "down";
this.speed = 13/5;
this.spriteSheetX = 0;
this.spriteSheetY = 0;
this.spriteSheetWidth = 55;
this.spriteSheetHeight = 55;
}
if ( type == "green" ) {
this.health = 100;
this.maxHealth = 100;
this.x = 0;
this.y = 0;
this.direction = "down";
this.speed = 5/5;
this.spriteSheetX = 330;
this.spriteSheetY = 0;
this.spriteSheetWidth = 55;
this.spriteSheetHeight = 55;
}
if ( type == "blue" ) {
this.health = 100;
this.maxHealth = 100;
this.x = 0;
this.y = 0;
this.direction = "down";
this.speed = 8/5;
this.spriteSheetX = 385;
this.spriteSheetY = 0;
this.spriteSheetWidth = 55;
this.spriteSheetHeight = 55;
}
if ( type == "red" ) {
this.health = 100;
this.maxHealth = 100;
this.x = 0;
this.y = 0;
this.direction = "down";
this.speed = 12/5;
this.spriteSheetX = 440;
this.spriteSheetY = 0;
this.spriteSheetWidth = 55;
this.spriteSheetHeight = 55;
}
if ( type == "boss" ) {
this.health = 100;
this.maxHealth = 100;
this.x = 0;
this.y = 0;
this.direction = "down";
this.speed = 8/5;
this.spriteSheetX = 495;
this.spriteSheetY = 0;
this.spriteSheetWidth = 110;
this.spriteSheetHeight = 110;
}
this.level = level;
}
$('#gameCanvas').ready(function() {Game_Open();});
$('#gameCanvas').keydown(function(e){ lastKeyPressed = e.keyCode; keyPressedArray[lastKeyPressed] = true; Key_Down(); return false; });
$('#gameCanvas').keyup(function(e){ lastKeyPressed = e.keyCode; keyPressedArray[lastKeyPressed] = false; Key_Up(); return false; });
$('#gameCanvas').mousedown(function(e){ mouseX = getMousePos(canvas,e).x; mouseY = getMousePos(canvas,e).y; mousePressed = true; $(this).focus(); Mouse_Down(); return false; });
$(window).bind('mouseup',function(e){ mouseX = getMousePos(canvas,e).x; mouseY = getMousePos(canvas,e).y; mousePressed = false; Mouse_Up(); return false; });
$('#gameCanvas').mousemove(function(e){ mouseX = getMousePos(canvas,e).x; mouseY = getMousePos(canvas,e).y; Mouse_Move(); return false; });
$('#gameCanvas').attr('tabindex', '0');
jQuery('#gameCanvas').bind('beforeunload', function(){ Game_Close(); $(window).unbind('mouseup');});
</script>
if moveX = 1 Then this.direction = "right"
if moveX = -1 Then this.direction = "left"
if moveY = 1 Then this.direction = "down"
if moveY = -1 Then this.direction = "up"
if moveY = 1 and moveX = 1 Then this.direction = "rightdown"
if moveY = -1 and moveX = 1 Then this.direction = "rightup"
if moveY = 1 and moveX = -1 Then this.direction = "leftdown"
if moveY = -1 and moveX = -1 Then this.direction = "leftup"
//Get the player's approximate new tile
var newX = (this.x + moveX*this.speed)
var newY = (this.y + moveY*this.speed)
var tileX = Round(newX/44)
var tileY = Round(newY/44)
Okay that's my bad... ::) Speed is 13/5 for whatever reason.I'll make the collision-wall boxes slightly smaller. And I'll see if I can use circle collision (using Circuit's awesome circle collision demo) for the zombies so they'll be able to get around each other. Especially when trying to fit in door ways.
And it's looking good. I'd make collision distance in general a bit smaller whether they become circles or not since zombies now have a problem with not letting each other through doorways. :)
I like how the process went with this project, it was sort of like making a mock-up using Silver Creator. And this shiny new one is already an improvement.
2 minor things the game needs:1. Completely agree. Like an ax or using hands or something. Beat the snot outta zombies.
1. A melee weapon, when I run out of ammo, it shouldn't just mean I'm dead.
2. A skip button for the intro lol
I agree, if we can set it up to switch weapons that would be fantastic. But we'll need some different player sprites. And animations are not necessary but they would look so cool...Animations would look awesome.
I think I made a basic one for a zombie attack.
localStorage.mySavedGame = "blablabla"
Uh, no offense gan, but I've said this game needed a story and cutscenes before. It's a great idea, and it's something I can help with! Since I can't program to save my life, and I suck at art, I've wanted to help for a long time, but there isn't that much that I can do. I think it's funny how this started out as a remaking retro games project, and no one's bothered to make a new thread.I am offended! >:(
Yes the name remains the same! But let's keep this thread going so we don't wind up confusing people.Pathfinding is easy. I'll patch it up. What's not so easy is raycasting. If someone makes raycasting, I can make the laser and line of sight feature.
Also I'd like to know more about how you do the pathfinding, it's an interesting problem and I haven't been brave enough to try it on my own. It's even more of a mystery than the raycasting stuff, remember Hacksilver with the limited view? I understand it traces lines radiating out from the player but not how it finds the FIRST thing they intersect with.
awesome I'd love to help if you guys need anything, it sounds like a fun time.Help out with the storyline or play with the game template! We sure could use your help.
To make this we're gonna need Circuit's magical circle code. And we'll calculate the line of tangency and the closeness and calculate a push force. A force that pushes the front guy forward and slows the guy doing the pushing.Though I enjoy being complemented for my code, what you're talking about is actually a lot more advanced than anything I've programmed. :) I can think of a way to do that, but you can probably find a more efficient way using trigonometry.
The demon was an experiment held on board the station to see how grizzly bears would react to zero-gravity, but when the AI got corrupted by a virus sent out by the evil force the experiment went horribly wrong and the bear got mutated.That's awesome. (http://gamemakersgarage.com/forum/chat/Smilies/XDFace.gif)
Actually you CAN go overboard with zombie AI. Zombies are not very smart (hence the want of Braaiins)Ahahahah
Just a thought about screen size:
How big are we gonna make it. I think it should take up the entire window.
As for having the game take up the whole window, it'd mean that we need to compensate for window resizing. Which wouldn't be too hard. It'd just make things a bit more work.That would be good. I have a MacBook, and the game is too tall to fit my 1280x800 pixel screen.
You guys up for it?
yeah I think the only thing we should have in mind is polymorphism, or adaptability. so that we can change everything in one place instead of searching all over the code. Such as using macros over integer constants, especially the ones used more than once. and most things through functions. I may go through myself and try to do that.
function enemy(x, y) {
var hp;
var x;
var y;
var startingHp;
var movable;
var chases;
var level;
this.x = x;
this.y = y;
}
function demon(x, y) {
this.chases = true;
this.movable = true;
this.level = 1;
this.startingHp = 25;
this.hp = 25;
enemy.call(this, x, y);
}
demon.prototype = new enemy();
I retired from the "army", if you could call it that, years ago after the first encounter. I was aboard the fleet of ships when they first struck. It was not expected. Many of us didn't even believe there was life on other planets. We just thought of space as a big garbage disposal with our name on it. We were mistaken. After several problems concerning containment chambers designed to hold nuclear waste, the newly formed World Government decided to chuck it in to space. Brilliant idea, right? Wrong. That all happened when I was a kid. When I grew up, I wanted to work for the Government that ended war forever, or so we thought. There were no soldiers. We didn't need them. With one government, why would we ever fight again. We maintained peace for a long time, but not forever. 23 years after we jettisoned our waste into space, we got an unfortunate message. The message was this: The almost total destruction of our main space station, which I was aboard 2 years ago. The waste we launched into space landed on a planet far away which was inhabited by reptilian beings of a far more advanced society than ours. They waged war on whoever forsook their beautiful planet and spent a few years tracking us down and preparing to blow up our planet. But first they wanted to warn us, and make us feel guilty for something we had no idea could ever happen. I quit working with the government to be with my family until the sure to come end of the earth as we knew it. But it didn't come. Interplanetary battle, as should be assumed, is almost impossible. Both side had diseases the others didn't have, and the other side had absolutely no immunity whatsoever to our diseases. They went to go find a solution to that problem, and what did we do? We build a massive space station to "Keep them away".
We're doomed.QuoteJuly 9th, 20XX
[character name here],
Your services are required aboard the [Space station name here]. [space station] is a space station operated by the world's government to protect against [antagonistic forces here]. We are recruiting many trained soldiers such as yourself to go on the next flight to the station. You will be serving your planet by defending and operating this ship. We do not doubt your ability to succeed in your duties of protecting the planet we all call home. You will be shipped out on the 20th.
THIS IS NOT OPTIONAL
Signed
Lt. Beck
They went to go find a solution to that problem, and what did we do? We build a massive space station to "Keep them away".
We're doomed.
"No spell can reawaken the dead.""Afraid I might have sat on it at some point, but I imagine it'll taste fine just the same."
—Albus Dumbledore