Pages: 1 2 [3] 4 5 ... 64
  Print  
Author Topic: Game Maker Help Thread!  (Read 325828 times)
Darkness3313
Mosskid
*
Posts: 710


That reminds me of a puzzle...


View Profile
« Reply #30 on: January 08, 2010, 11:27:08 PM »

You need to use, ScrGenerateitem.
Logged
ipwnu1337
Guest
« Reply #31 on: January 09, 2010, 10:53:48 AM »

I've gone there, and did some copying and pasting, but I still cannot get the item to spawn from the crates.  Help please?
Logged
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #32 on: January 09, 2010, 11:02:21 AM »

what did you do? can you post what you messed with?
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Darkness3313
Mosskid
*
Posts: 710


That reminds me of a puzzle...


View Profile
« Reply #33 on: January 09, 2010, 11:19:36 AM »

else if (rand(1,60) == 1) obj = instance_create(chest.x, chest.y, oOBJECT);
in oPlayer1 : step : Action
Scroll down a little and you'll see a
//crate
comment


Replace OBJECT with whatever you are adding.
Logged
ipwnu1337
Guest
« Reply #34 on: January 09, 2010, 11:34:54 AM »

what did you do? can you post what you messed with?

Okay, lets see, I'm attempting to add a new gun to the game.  I've added the left and the right sprites, and added object oSubMachineGun to the objects folder.  I've also tinkered with the firingmax code, and reduced the firingmax to 1, and added the firingSubMachineGunMax to 5.  I've tried to get it to spawn through the scrGenerateItem code, but it doesn't work.


Any idea on how it to spawn from pots 100% of the time, rather than crates?
Logged
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #35 on: January 09, 2010, 11:35:54 AM »

Yay machine guns!!!
Logged

I made a rap.
It sounds dumb, like reading a map
I really should stop this thing before it goes too far
But I don't really car as long as I stay below the radar
Those big companies won't get me no
I'll get away before the fuzz show

-Most famous rapper of Mossmouth
Kirbylord
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #36 on: January 09, 2010, 11:47:57 AM »

what did you do? can you post what you messed with?

Okay, lets see, I'm attempting to add a new gun to the game.  I've added the left and the right sprites, and added object oSubMachineGun to the objects folder.  I've also tinkered with the firingmax code, and reduced the firingmax to 1, and added the firingSubMachineGunMax to 5.  I've tried to get it to spawn through the scrGenerateItem code, but it doesn't work.


Any idea on how it to spawn from pots 100% of the time, rather than crates?

If you go to; oJar - destroy - execute code;

if (rand(1,3) == 1) instance_create(x, y, oGoldChunk);
    else if (rand(1,6) == 1) instance_create(x, y, oGoldNugget);
    else if (rand(1,12) == 1) instance_create(x, y, oEmeraldBig);
    else if (rand(1,12) == 1) instance_create(x, y, oSapphireBig);
    else if (rand(1,12) == 1) instance_create(x, y, oRubyBig);
    else if (rand(1,6) == 1) instance_create(x-8, y-8, oSpider);
    else if (rand(1,12) == 1)
    {
        if (colLeft) instance_create(x, y-8, oSnake);
        else if (colRight) instance_create(x-16, y-8, oSnake);
        else instance_create(x-8, y-8, oSnake);
    }

change all that to;

if (rand(1,1) == 1) instance_create(x, y, oMachinePistol);

or what you called it  Smiley
Logged
ipwnu1337
Guest
« Reply #37 on: January 09, 2010, 11:54:41 AM »

Ah, okay, nice.

I've got it to spawn, but all it gives is an error message, reproduced here:

___________________________________________
ERROR in
action number 1
of  Step Event
for object oItem:

Error in code at line 71:
           moveTo(xVel, yVel);
                  ^
at position 17: Unknown variable xVel


Man, I'm really bad a this.
Logged
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #38 on: January 09, 2010, 12:10:47 PM »

Ah, okay, nice.

I've got it to spawn, but all it gives is an error message, reproduced here:

___________________________________________
ERROR in
action number 1
of  Step Event
for object oItem:

Error in code at line 71:
           moveTo(xVel, yVel);
                  ^
at position 17: Unknown variable xVel


Man, I'm really bad a this.

not sure, but have you remembered calling the inherited event under step for your gun?
 
Logged
ipwnu1337
Guest
« Reply #39 on: January 09, 2010, 12:14:34 PM »

Inheirited event under what?

What is that?
Logged
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #40 on: January 09, 2010, 12:22:28 PM »

It simply means it should do all the code under step; the "execute pierce of code" command, as wall as all the code of it's parent object (in this case oItem) under it's step

you can see it below (not sure if it's the problem)
Logged
ipwnu1337
Guest
« Reply #41 on: January 09, 2010, 12:43:37 PM »

Oh, right,  I haven't filled anything in there.

And I don't know how.

[EDIT] Nevermind, I think I've got it figured out.  I'll just need to test it.

[EDIT#2]  Huh, it works, but there are a handful of problems:

The rapid-fire capibility only works when facing the left side.  Wierd.
When whipping the pot open on a level with a store, a $ sign appears over it, and you'll be accused of stealing if you pick it up, however, if you throw the pot, it won't trigger it.
The gun can't be transported through levels.

Hrm.
« Last Edit: January 09, 2010, 01:06:00 PM by ipwnu1337 » Logged
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #42 on: January 09, 2010, 01:10:16 PM »

Oh, right,  I haven't filled anything in there.

And I don't know how.

[EDIT] Nevermind, I think I've got it figured out.  I'll just need to test it.

[EDIT#2]  Huh, it works, but there are a handful of problems:

The rapid-fire capibility only works when facing the left side.  Wierd.
When whipping the pot open on a level with a store, a $ sign appears over it, and you'll be accused of stealing if you pick it up, however, if you throw the pot, it won't trigger it.
The gun can't be transported through levels.

Hrm.


sound pretty good, the fire bug, is properly because you only changed the first part of the code, below that - should be a facing right; you need to change that to.

the code under oJar, change it like this;
if (rand(1,1) == 1)
{
obj = instance_create(x, y, oMachinePistol);
obj.cost = 0;
obj.forSale = false;

}

when the gun spawns, it will no longer be on sale

under your object create event it should have a type - like this;

type = "Shotgun";
makeActive();
setCollisionBounds(-4, -4, 4, 4);
cost = 15000;
buyMessage = "A SHOTGUN FOR $" + string(cost) + ".";

you need to add that type to scrHoldItem - like this;

else if (itemType == "Shotgun") holdItem = instance_create(x, y, oShotgun);

this will make the Item spawn in your hand in the next level

and that should be it  Smiley
« Last Edit: January 09, 2010, 01:20:23 PM by Delver » Logged
ipwnu1337
Guest
« Reply #43 on: January 09, 2010, 01:50:32 PM »

Ah, ok, that solves all the problems.

The only other problem, though mostly visual, is that the submachinegun appears to be off-centered, and lookslike the spelunker is holding it with his foot, though the bullet comes out where it usually should.  I'm sure it's not problems with the sprite itself, and I copied and pasted all the code for the item from the pistol and shotgun.

Wierd.
Logged
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #44 on: January 09, 2010, 01:55:41 PM »

nicely done  Smiley

might be your sprites center thats of:
Logged
Pages: 1 2 [3] 4 5 ... 64
  Print  
 
Jump to: