Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411278 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 12:57:52 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Game Maker For Beginners: Part II
Pages: 1 ... 4 5 [6]
Print
Author Topic: Game Maker For Beginners: Part II  (Read 136258 times)
aharlow95
TIGBaby
*


View Profile
« Reply #100 on: June 19, 2012, 03:00:52 PM »

Which object would I edit to reduce firing? the ship or the bullet, or even a new object?
 P.S. Sorry if you already explained this.
Logged
ink.inc
Guest
« Reply #101 on: June 19, 2012, 04:33:29 PM »

edit the variable firingdelaymax in the create event of the ship
Logged
Keops
Level 6
*


Pixellin' and Gamedev'n


View Profile WWW
« Reply #102 on: June 24, 2013, 05:46:23 AM »

Hey there, sorry for resurrecting a very old thread, but I just started learning GameMaker (now GameMaker Studio) as a way to create quick prototypes of my game ideas.

I'm working on the part where you make the ship shoot, but when I press the X key I get an error message. This is the text I get:

Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object oPlayerShip:

Push :: Execution Error - Variable Get -1.oPlayerShot1(100003, 0)
 at gml_Object_oPlayerShip_Step_0 (line 17) -     instance_create(x, y, oPlayerShot1);
############################################################################################

I don't have the slightest idea what this means.

At any rate I'll keep fiddling with the program and see what can I discover.

Thanks for the tutorials, Derek!
Logged

Hearthstead: Hand Point Right Website - Twitter Hand Point Left

OPEN FOR COMMISSIONS! Behance portfolio
Ant
Guest
« Reply #103 on: June 24, 2013, 05:50:05 AM »

Looks like you haven't created an oPlayerShot1 object.
Logged
Keops
Level 6
*


Pixellin' and Gamedev'n


View Profile WWW
« Reply #104 on: June 24, 2013, 06:01:09 AM »

Looks like you haven't created an oPlayerShot1 object.

Oh yeah, that fixed it. I had my doubts regarding that, but I got confused with the instance_create thing, I thought it would automagically create the object. I already had a oPlayerShot object there, just without the number.

Thanks for the help caiys!
Logged

Hearthstead: Hand Point Right Website - Twitter Hand Point Left

OPEN FOR COMMISSIONS! Behance portfolio
Keops
Level 6
*


Pixellin' and Gamedev'n


View Profile WWW
« Reply #105 on: June 25, 2013, 06:38:22 AM »

I'm almost done with this part of the GM tutorial, but I have a little problem.

Since I'm using the current version of GM Studio, something has changed in the way you destroy an object. There is a "destroy" type event I can add to the oExplosion object, but it doesn't stay there so I assume you have to add some GML script or something.

Anyone know how to do this in the current GM Studio version? In my tutorial game the explosion just keeps looping where the enemy collides with the shot, so it never disappears.

Thanks in advance!
Logged

Hearthstead: Hand Point Right Website - Twitter Hand Point Left

OPEN FOR COMMISSIONS! Behance portfolio
DavoTron
Level 0
*


View Profile
« Reply #106 on: December 09, 2013, 09:00:18 AM »

I was going through this tutorial and didn't quite get the same results.

For example, when the bullet hit the monster, the game crashed as it didn't understand the code.

After some tinkering, I got somewhere. Kinda. I had a number of enemies on screen, and the one I shot disappeared - While the other exploded. Great. Oh, and the bullet still went flying.

A little bit more messing around, I hit upon some solutions -

Giving the bullet it's own set of hit points. That way, both the enemy and the bullet subtract a point from each other, and both disappear. Not exactly elegant, but functional. Also, I remember removing the bit where it says 'other' next to 'other.hp' and other.x / other.y -Seems to be working as intended now.

However, the explosion seems to animate slightly below where I shoot the enemy, but we'll ignore that for now.
Logged
ink.inc
Guest
« Reply #107 on: December 09, 2013, 01:45:44 PM »

this tutorial was intended for gm8 and earlier; some of its functions may/may not be named differently from those used in gm studio (if that's what you're using)
Logged
DavoTron
Level 0
*


View Profile
« Reply #108 on: December 15, 2013, 03:08:53 PM »

Aye, I guess that's why. I hope my post helps anyone who got equally as confused as I did.
Logged
Brel
Level 0
*


View Profile
« Reply #109 on: January 10, 2014, 01:04:33 AM »

Thanks for the tutorial Derek.  Smiley

These are the parts of the Tutorial I got especially confused with and I've indicated below how I managed to solve my problem as this might help someone:

Code:

Quote
other.hp -= 1;
instance_destroy();

Inside the object oPlayerShot, create a Collision Event and select oEnemyBasic as the object that will be collided with.  Add the corresponding Execute Code and place the above lines of code within.


Code:

Quote
if (hp < 1)
{
    instance_create(other.x, other.y, oExplosion);
    instance_destroy();
}

Place these code in the Step Event of object oEnemyBasic.
Logged
Ant
Guest
« Reply #110 on: January 10, 2014, 01:14:00 AM »

i don't think you meant to put those "other"s in the instance_create function
Logged
Brel
Level 0
*


View Profile
« Reply #111 on: January 10, 2014, 10:10:20 AM »

i don't think you meant to put those "other"s in the instance_create function

Hi!  I did not place any of those mentioned codes inside a Create Event function. The codes were placed only inside a Collision Event (for the oPlayerShot object) and Step Event (for the oEnemyBasic object) functions. 

In the original provided tutorial, the naming of the Sprites and Objects I think have some mistakes.  To clarify this, here are all the Sprites, Objects, & Rooms that I have used for this part of the tutorial:

Sprites:
- sPlayerShip
- sPlayerShot
- sEnemyBasic
- sExplosion

Objects:
- oPlayerShip
- oEnemy
- oEnemyBasic
- oPlayerShot
- oExplosion

Rooms:
- rLevel1

This seemed to work for me.  Any enemy sprites I shoot explodes and disappears when hit.
Logged
Ralflorian
Level 0
*


View Profile
« Reply #112 on: January 23, 2014, 05:04:15 AM »

Hello everyone, is there a way to fix this little problem i have with shooting (following this tutorial)?

When i move forward or backward, the shooting rate changes, i shoot more bullets when i'm MOVING horizontally forward and less bullets when i'm moving backwards. Maybe it's something about the relative position of bullet?  The fire delay? I'm just clueless.
Logged
ink.inc
Guest
« Reply #113 on: January 23, 2014, 05:12:28 AM »

you're shooting the same amount of bullets, they just look closer together because your ship is moving forward. if you move backward, they look further apart. in fact, you can verify this by running the game in debug mode and checking the number of instances currently in the room. there's nothing you can do about this except:

1. make the bullets move fast enough so that the distance is unnoticeable (in the create event of oPlayerShot, set xVel to a different number)

2. add the ship's current speed to any bullets it creates on that frame (in the step event of oPlayerShip:
Code:
if (keyboard_check(ord('X')))
{
   with instance_create(x, y, oPlayerShot1)
   {
      xVel+=oPlayerShip.xspd//xspd is the ships horizontal speed, or how many pixels it is currently moving horizontally this frame
   }
}
« Last Edit: January 23, 2014, 05:26:49 AM by John Sandoval » Logged
Ralflorian
Level 0
*


View Profile
« Reply #114 on: January 23, 2014, 06:18:08 AM »

Works great, thanks
Logged
Indiana-Jonas
Level 0
***



View Profile WWW
« Reply #115 on: February 05, 2015, 01:41:49 PM »

I get an error where the hp variable is not recognized.
The error is pointed out at this position in the object EnemyBasic

if (hp < 1)

it says that the variable is unknown!

i saw a few others had the same/similar problems but I never really found out if they solved it. I'd really appreciate some help!
Logged

Canned Turkey
Guest
« Reply #116 on: February 05, 2015, 02:12:59 PM »

1. that would be better stated as:

Code:
if hp < 1;
{
//die
}

2. You need to define a variable before it's called.
the create event is my favorite for that.
So in the create event for EnemyBasic:

Code:
hp = //a number//;
Logged
Indiana-Jonas
Level 0
***



View Profile WWW
« Reply #117 on: February 08, 2015, 11:52:42 AM »

I figured it out!

Thank you Canned Turkey!
Logged

Canned Turkey
Guest
« Reply #118 on: February 10, 2015, 12:52:24 PM »

No problaimo.
Logged
Pages: 1 ... 4 5 [6]
Print
Jump to:  

Theme orange-lt created by panic