Lol, got it to work now, thanks cairnswm! Ja, I see why it wasnt working now!!!
Heya guys. I have another question. :-) After I complete Marble Mania I want to create a traditional scrolling space shooter. Something along the lines of Deimos Rising, where I'll be using 2D sprites of 3D models and terrain. Since I'll be using alot of sprites in this game, I would like to know:
Which with be the best method to create the stages? Should I create one large room and have my jet gradually scroll over it? Or should I create a normal sized room and have my sprite objects and background objects appear at specific times (by making them instances)?
Which would work best as it relates to loading time and file size?
Ok, I've got a total noob question here! Ive got a variable, ring_score(found in the ring object), now this variable is going to affect the player object(user_obj) later on! The problem is when I try use the ring_score variable in my player object, it says that the object does not exist! Do I have to put .global in front of the variable for it to affect other objects?
My next problem is that I want to draw this variable, so this is what I have:
Ring Object:
Timer Code:Code:Create: ring_score = 0 //(I find that if I dont do this it says no variable exists!!!) ringx = random(800) ringy = random(600) Collision: ring_score +=1 instance_create(ringx, ringy, ring) Destroy self
Sorry its so long!!! The problem I have is, when I draw global.ringnum, it stays as 0 the whole time!! Please help!!!Code:Create: time = 15 Step time -=0.033333333333333333333333333333333 Draw: draw_text(10, 10, time) draw_text(10, 40, global.ringnum) //I put it in here because when I put it in the ring object it doesnt draw the sprite of the ring!!!
Every object in Game Maker has an Id. The easiest thing about Ids is that they are the same as the names. Now global is just a special object that always exists called global.
So what I think you want in the timer code is
draw_text(10, 40, RingObjectName.ring_score);
But you'll have to test it.
Its still not working, the number still stays at 0! Lol, never mind!!! Stupid mistake, got it now!!! I made ringnum = 0 in the create event of the ring object, forgetting that every time I collided with a ring, it created a new one, thus always setting the variable ringnum to 0!!! :P
Last edited by CiNiMoDZA; 15-08-2007 at 11:12 PM.
Glad you spotted that, I saw it last night but couldn't reply for some reason :)
-D
Ok, me again :P I want to get the time that I collided with the object, so what I have is:
In the ball object:
Collision:(With the player object)
catch_time = timer.time
room_goto(room6)
Then in the object to draw the score:
Draw:
draw_text(10, 10, practice_ball.catch_time)
But it says there's no such variable, am I doing something wrong that Im missing here?
Nvm, got it! I just made the ball persistent! Is this the right way to do it though!?!
Last edited by CiNiMoDZA; 16-08-2007 at 01:24 PM. Reason: Sorted!!!
It most certainly is. It depends though. When a room ends, it deletes all the objects (unless they or the room is persistent).
Time to show my noob-ness again... but at least I'm improving a bit ^^
I'm kinda stuck with a little (and probably simple) problem. I want pinball-like physics but I'm not completely sure about the collisions.
First of all, how would I change the weight of objects? For example, a steel ball in comparison to a wooden ball. For this I'm sure I just have to play around with the Vertical Speed and Gravity?
Secondly, when the ball hits the floor, I want it to bounce, slow down, and eventually stop. I figured out how to make it bounce and stop after doing the Platformer Tutorial but, I'm stuck at getting it to stop when its moving horizontally and vertically at the same time.
Truthfully, I didn't really know what I was doing, so I need help. For the whole bounce-to-stop thing, my code looked like this:
obj_Ball:
Step:
Bounce Against Objects;
IF position (relative to) is collision free (0, 1, Only Solid)
Gravity(270, 1);
ELSE
Gravity(270, 0);
End Step:
IF vspeed = 0;
Move Contact in Direction(270, 1);
I don't know exactly how correct that is but it does seem to work, vertically. I tried replacing the IF in my End Step with "IF vspeed = 0 && hspeed = 0", but it didn't work. Not even sure if its &&(and) or ||(or). I usually get the two mixed up =/ (Though I did try both)
EDIT: Got it figured out now.
Last edited by RedNax; 21-08-2007 at 06:22 AM.
Ok, so Ive got this person! Now behind the person I want to make little sparkle dust stuff!!! How would I do this using GM 6.1!!!
Nvm, got it :P
Last edited by CiNiMoDZA; 21-08-2007 at 01:00 AM. Reason: Figured out!
Ok guys, I got the problem!!!
Here goes! I need my Mr AI man to get the ball, now when he's under pressure I want him to pass it! So this is what I got! In the AI's step event:
And in the Quaffle step event:Code:oppPosX = center_chaser_ut.x oppPosY = center_chaser_ut.y shootPosX = x + lengthdir_x(50, direction); shootPosY = y + lengthdir_y(50, direction); if (x - oppPosX < 80 and y - oppPosY < 20 and Caught = 1) instance_create(shootPosX, shootPosY, Quaffle) Quaffle.pass = 1 Quaffle.passPosx = right_chaser_cpu.passPosX Quaffle.passPosY = right_chaser_cpu.passPosY Caught = 0
The problem I have is, as soon as I run the game, the Quaffle is moving towards 0,0! I understand that its moving to this because in the create event I have:Code:if (pass = 1) move_towards_point(passPosX, passPosY, 7)
But still, it shouldn't because pass = 0 and its only supposed to move there when pass = 1?Code:shot = 0 pass = 0 passPosX = 0 passPosY = 0
Please feel free to tell me easier ways to do things that I've coded, Im still pretty new to GML so ja! Thanks guys!
Link:http://gamedev.openhazel.co.za/filec...62/AI_Main.gm6 (16k) GM 6.1 Reg
Please just look through and give me pointers as Im new to the whole AI thing!
Last edited by CiNiMoDZA; 22-08-2007 at 10:20 PM. Reason: Link to file
Passs is always 1
Try useing coding blocks:
if (x - oppPosX < 80 and y - oppPosY < 20 and Caught = 1) then
{
instance_create(shootPosX, shootPosY, Quaffle)
Quaffle.pass = 1
...
}
I want to make the sprite rotate in direction with the mouse? How do I do this?
(excuse me, but i'm a complete noob to game development and i'm only 14..)
And where can I buy THE GAME MAKER APPRENTISE (book) the cheapest? Is it worth buying?
The rotation thing was covered in NAG a while ago. It's now up on the Game.Dev website :)
To make an object always point towards the mouse cursor, simply get the relative direction using something like:
facingDirection = point_direction(x, y, mouse_x, mouse_y);
And then use the facingDirection variable you've just created in the rotation logic.
I'm not sure about the book, I think you can get it from Take2.co.za AFAIK. I'd recommend it if you don't have any programming experience at all and have the commitment to work through the whole book. Good luck and welcome :)
-D