Poll

I'm not sure how to delete this pole.

Ok, cool.
0 (0%)
That's lame.
0 (0%)
Alright, you're kindof stupid.
2 (100%)
I don't care, I'm just here for the free cake.
0 (0%)

Total Members Voted: 2

Topic:   Retro games   (Read 314625 times)


0 Members and 1 Guest are viewing this topic.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Retro games
« Reply #270 on: January 22, 2012, 07:37:35 AM »
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
Code: [Select]
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?

i'll look into making an enemy that shoots a laser weapon, but projectiles cause to much lag
« Last Edit: January 22, 2012, 07:44:33 AM by EqwanoX »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Retro games
« Reply #271 on: January 22, 2012, 12:26:59 PM »
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.
« Last Edit: January 22, 2012, 12:28:37 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: Retro games
« Reply #272 on: January 22, 2012, 01:19:49 PM »
Maybe we need an unlocked door, so you can let the player choose when to fight some zombies, but save the keys for later.
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: Retro games
« Reply #273 on: January 22, 2012, 01:26:43 PM »
Is space marine the official name now?
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: Retro games
« Reply #274 on: January 22, 2012, 01:33:57 PM »

Here's a boss level. Replace the demon with a boss. The last room before the boss is completely walled off so you're at full health to fight him. Needs on kill doors though, as it is the player could sneak past the boss to the exit.

Code: [Select]
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"
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Retro games
« Reply #275 on: January 22, 2012, 07:08:55 PM »


The porportions are a bit off but it's lookin a little better. Needs more tweaking, thinner and more round legs.
« Last Edit: January 22, 2012, 07:12:44 PM by Gan »

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Retro games
« Reply #276 on: January 23, 2012, 07:40:23 AM »
his knees seem to be bending sideways? i think if you fix that and stretch the legs out it would look alot better, and then you could work from there just adding definition.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Retro games
« Reply #277 on: January 23, 2012, 08:07:27 AM »
That's intense!
I'm definitely gonna try this. Awesome pointers!

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: Retro games
« Reply #278 on: January 23, 2012, 03:30:33 PM »
Great job with the 3D character! looking awesome. Is Eq gonna make the textures?
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Retro games
« Reply #279 on: January 23, 2012, 07:30:08 PM »
This is reminding me of some of the things I had to do in Animation class. We never really got into texture mapping, maybe I'll look at some tutorials when I've got the time.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Retro games
« Reply #280 on: February 08, 2012, 10:12:25 PM »
I've done a bit of a retro re-write in HTML5:
http://gamemakersgarage.com/html5/HTML5-ShareGame.php?gameID=156

You guys can check out the source in the templates section of the HTML5 GM. Or paste this code into the HTML5 GM:
Code: [Select]
["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}]]

I actually didn't convert the code, I did just re-made it from how the game looked.
If one of you guys could re-do my movement code, that'd be fantastic cause it's not as awesome as the original movement.

Edit: If it looks slow, that's just because we need to up the movement speed of the player and bad guys.
« Last Edit: February 08, 2012, 10:17:48 PM by Gan »

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: Retro games
« Reply #281 on: February 08, 2012, 10:46:43 PM »
Looks good!  I really like the new OOP code style.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Retro games
« Reply #282 on: February 09, 2012, 07:07:08 AM »
holy shit, well done. its so smmoooth, i love it. we gotta port over the levels.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Retro games
« Reply #283 on: February 09, 2012, 08:57:12 AM »
EDIT: I figured out why it was hard-coded to 1 and fixed Gan's bloody movement/rotation code to use Greater Than and Less Than zero so you can set the variable "speed" to whatever you want, without editing 14 numbers. @Gan: stats such as speed, attack power, bomb radius and whatever else you can think of should be variables so we can tweak gameplay if we want.
But that's another thing, should all powerups carry over or not? In the Silver Creator game you kept your gun and I think armor at the end of a level but not the boots! You also lose them all when you die. You should never be stuck without items that might be required because of one mistake. We should just decide what you keep when you die, for example you keep better weapons after death because they can be essential but lose extra things such as extra armor and speed.
And finally, the object oriented code is way cool and should make it much easier to edit different types of enemies and add items.
I keep thinking of stuff to add, umm let me make sure I got it all...
Oh yeah! The movement code is divided between the level class and the character class. Was that really necessary? And Gan you never use Switch statements they're so useful! It probably won't be a problem but I would have done it different. XD
EDIT #20:
If you try to run around the outside of the smiley face level there's an invisible wall! Might want to fix it.

Code: [Select]
<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>
« Last Edit: February 09, 2012, 10:05:58 AM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Retro games
« Reply #284 on: February 09, 2012, 11:21:05 AM »
Hmmm. Connors, the speed wasn't hard coded. MoveX and MoveY are 1 or -1 to define the movement direction.
Speed is actually stated in the Character's On Construct method. And it's applied in the Run method.

The movement thing I want fixed is how the character can all too easily catch on corners of the blocks. And how the big bad guy can't go through tiny spaces.

I'll fix the invis wall.