Game Maker's Garage Forum

Game Creation => GameMaker => Topic started by: Zoo on December 09, 2011, 06:33:21 PM

Title: The Epic Maze of Scary Monsters
Post by: Zoo on December 09, 2011, 06:33:21 PM
I'm making this game called TEMSM (The Epic Maze of Scary Monsters)
And it's working pretty well. The code is on the.... um.... heavy side...
It's hard to work with, and adding another wall to the game would be hard because of that. I also want to make it so the enemy doesn't walk off the screen. Is anyone willing to look over my code and tell me how I should work with it?
http://www.mediafire.com/?k5fnvosa45p62ce
Code: [Select]
Loop movie

x1 = 205
y1 = 205
h = 1
x = 5
y = 5
SPRITE 1 x y Player.gif
SPRITE 2 105 55 Block.gif
SPRITE 3 x1 y1 Block2.gif
ON KEYDOWN
 
  sc = SPRITECOLLIDE 1 2
  sc2 = SPRITECOLLIDE 1 3
  sc3 = SPRITECOLLIDE 1 4
  IF keydown$ = "w" THEN
    IF sc = 0 THEN
      IF sc2 = 0 THEN
        y = y - 10
        SPRITE 1 x y Player.gif
      END IF
    END IF
    IF sc = 1 THEN h = h - 1
    IF sc2 = 1 THEN h = h - 1
    IF sc3 = 1 THEN
      counter = counter + 5
      SPRITE 4 0 0 n/a.gif
    END IF
  END IF
 
  IF keydown$ = "s" THEN
    IF sc = 0 THEN
      IF sc2 = 0 THEN
        y = y + 10
        SPRITE 1 x y Player.gif
        IF sc3 = 1 THEN
          counter = counter + 5
          SPRITE 4 -656 -1641 n/a.gif
        END IF
      END IF
      
      
      IF sc = 1 THEN h = h - 1
      IF sc2 = 1 THEN h = h - 1
    END IF
  END IF
 
  IF keydown$ = "a" THEN
    IF sc = 0 THEN
      IF sc2 = 0 THEN
        x = x - 10
        SPRITE 1 x y Player.gif
        IF sc3 = 1 THEN
          counter = counter + 5
          SPRITE 4 -656 -1641 n/a.gif
        END IF
      END IF
      
      IF sc = 1 THEN h = h - 1
      IF sc2 = 1 THEN h = h - 1
    END IF
  END IF
 
  IF keydown$ = "d" THEN
    IF sc = 0 THEN
      IF sc2 = 0 THEN
        x = x + 10
        SPRITE 1 x y Player.gif
        IF sc3 = 1 THEN
          counter = counter + 5
          SPRITE 4 -656 -1641 n/a.gif
        END IF
      END IF
      
      IF sc = 1 THEN h = h - 1
      IF sc2 = 1 THEN h = h - 1
    END IF
  END IF
  IF h = 0 THEN GOTOCARD 10
END KEYDOWN



ON TIMER 15
  mytimer = mytimer + 1
  IF mytimer = 2 THEN
    ai = RANDOM 1 2 3 4
    IF ai = 1 THEN x1 = x1 + 50
    IF ai = 2 THEN x1 = x1 - 50
    IF ai = 3 THEN y1 = y1 + 50
    IF ai = 4 THEN y1 = y1 - 50
    SPRITE 3 x1 y1 block2.gif
    mytimer = 0
   
    IF counter > 199 THEN GOTOCARD 4
   
  END IF
 
  mytimer2 = mytimer2 + 1
  IF mytimer2 = 25 THEN
    csX = RANDOM 626
    csY = RANDOM 327
    SPRITE 4 csX csY coin.gif
    mytimer2 = 0
  END IF
END TIMER
The main code
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 14, 2011, 03:33:23 PM
Anyone? lol?
Title: Re: The Epic Maze of Scary Monsters
Post by: Gan on December 14, 2011, 03:43:56 PM
Ah sorry Zoo. I looked at this thread and meant to give it a go but all this studying has made me forget.

I have a final in 2 hours. After I finish my final I'll check it out and see if I can help.
Title: Re: The Epic Maze of Scary Monsters
Post by: Circuit on December 14, 2011, 05:38:57 PM
Looks interesting.  It would be easier to work with if you added comments, and gave the variables more meaningful names.  But I think I understand it for the most part.

I noticed that the keydown$ sections are mostly identical, with only slight differences.  You should put the key-specific code into a SELECT CASE structure, and put the general stuff (collision detection, etc.) either before or after the SELECT CASE.  That will make it more concise, efficient, and easy to work with.
Title: Re: The Epic Maze of Scary Monsters
Post by: Gan on December 14, 2011, 09:29:05 PM
:O I can't run GameMaker cause I'm on Lion.
Title: Re: The Epic Maze of Scary Monsters
Post by: GMG Kurt on December 14, 2011, 09:33:43 PM
I'll look at it tomorrow. [smiley=tongue2.gif]

SO whats up is something wrong with it, or your giving us an update on your awesome new game?
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 14, 2011, 10:09:47 PM
GM doesn't work on Lion either!? That means neither do the games. And Quest of Magic! Gads!
I should file a complaint. Soon they will be obsolete! :CCCC
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 15, 2011, 03:24:07 PM
I hope GM 4 will work on lion... otherwise I might have to *Shudders* use something else  [smiley=shocked2.gif] [smiley=shocked.gif]
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 15, 2011, 08:41:46 PM
You could learn SC pretty darn fast.

...Lol I said "gads".  ::)
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 16, 2011, 03:24:41 PM
I probably could.
Title: Re: The Epic Maze of Scary Monsters
Post by: Circuit on December 16, 2011, 04:28:19 PM
Quote
GM doesn't work on Lion either!? That means neither do the games. And Quest of Magic! Gads!
I should file a complaint. Soon they will be obsolete! :CCCC
Years ago, Mike wrote a program that adds Carbon code to old GM games.  This made them compatible with OS X.  I wonder if it would be feasible to add x86 code to make games compatible with Lion.
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 16, 2011, 07:05:52 PM
I've been wondering about that to, I remember "Carbon". It would be great if these survived longero
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 27, 2011, 10:47:26 AM
Are sc, sc2 and sc3 for collisions only?? If you want to be able to add walls you should make a FOR loop that goes through all sprite numbers that are walls, in this case 1 through 3. It could do the same thing for any wall depending on which side you hit.
And as for things going off the screen, just say if it's off the screen reset x or y to be back on. If x is less than zero then set x to zero.
Title: Re: The Epic Maze of Scary Monsters
Post by: EqwanoX on December 28, 2011, 06:56:22 AM
stop what your doing and learn sc, its easier use, much faster, and theres more support for it if you needed help
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 28, 2011, 10:04:31 AM
Yes sir, Sorry sir! Right away, Sir!  :P
Title: Re: The Epic Maze of Scary Monsters
Post by: EqwanoX on December 28, 2011, 10:06:21 AM
lol, its just my recomendation, useing gm is a dead end, why limit yourself, its lags with just 10 sprites on screen
Title: Re: The Epic Maze of Scary Monsters
Post by: Gan on December 28, 2011, 10:12:29 AM
They do say, limitation breeds innovation- err, or is that necessity?
Anywho, you get the point. Just look at Silver's games.
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 28, 2011, 04:37:09 PM
Oh yes! I still think it's fantastic how much he did with 7x7 tiles.
Title: Re: The Epic Maze of Scary Monsters
Post by: EqwanoX on December 29, 2011, 07:52:34 AM
yea i miss silvers games. that rpgengine was good as game, he should just add a new level once in a while for us to explore. the inventory system in that blew my mind, i can believe he did that without arrays or methods. but everyone leans towards gm to much when its not even being updated anymore. i think mike deserves some credit for developing something thats far superior and giving it to us for free.
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 29, 2011, 09:40:27 AM
I tried using silver creator, and realized something. I am like a walrus. I can't program very well, but I can adapt.
........
moo?
...
I made the simplest game possible. locked door, and a key. It works but I keep finding things that I wanted to use, like the PICT command or the ALERT command, which I couldn't find in the "Scripting help"
Title: Re: The Epic Maze of Scary Monsters
Post by: EqwanoX on December 29, 2011, 10:24:43 AM
thats what we're here for

theres a bunch of alert commands, i can only rememer NOTEALERT and CAUTIONALERT

notealert "hello"

whats the pict command do? if thats like sprites you have to import the picture, give it a name then

createsprite 1, "picture"
movesprite 1, 0,0
Title: Re: The Epic Maze of Scary Monsters
Post by: Zoo on December 29, 2011, 12:18:00 PM
No, pict changes the picture of the current card, to the picture in the specified card
Code: [Select]
PICT 5
for example, changes the picture of that card to the picture of card 5. Really useful for low-code games. I must have used it a thousand times in escape the house.
Title: Re: The Epic Maze of Scary Monsters
Post by: Connors on December 29, 2011, 08:06:16 PM
I don't think there's an SC function to change the background picture at all, but I wish there was. You'll just have to add another sprite.