View Full Version : So anyone doing the Tetris in Pictures thing?
dislekcia
02-04-2008, 02:48 PM
Any user created TetrisBlocks out there to fit into the framework? I'd be keen to see them!
-D
Afflict
03-04-2008, 10:16 PM
What frame work...?
dislekcia
03-04-2008, 11:46 PM
What frame work...?
The Tetris in Pictures series that's running in NAG at the moment? ... Does anyone actually do those? :(
-D
Afflict
03-04-2008, 11:59 PM
Uhm well... I have no idea since 7 / 11 had no nags spar had no nags... :P So no nags for me this month. I'm a lazy shopper, i don't drive around from one to the next. Sad thing is both those I think don't get supplied at all anymore..
FuzzYspo0N
04-04-2008, 12:13 AM
i bought april nag, havent read it yet. ill look at it ;0
Ive started, but havent got anything unique to show :P
I might even have my tetris spinoff from ages ago that I started, but it didnt work as you couldnt clear lines etc (set blocks and such) from my early messing around stages of game dev.
Kensei
04-04-2008, 11:36 AM
Just got my mag now - will try tonight.
I have to say this initially 'Holy crap, dislekcia you put how to make Tetris IN 2 PAGES!!!' :D
I'll get back to you :P
dislekcia
04-04-2008, 12:10 PM
Just got my mag now - will try tonight.
I have to say this initially 'Holy crap, dislekcia you put how to make Tetris IN 2 PAGES!!!' :D
I'll get back to you :P
4 pages. The TetrisBlocks are coming next month... That's why I'm challenging people to write their own using the current system in the meantime ;)
-D
FuzzYspo0N
04-04-2008, 01:11 PM
hmmi see now, makes sense once i read it :)
im making a pack of graphics for the users, if anyone wants or wants to forward it to the nag readers. or send them here. ill make more later, for now :
http://www.gamedev.za.net/filecloset/data/files/415/01.jpg
http://www.gamedev.za.net/filecloset/data/files/416/02.jpg
http://www.gamedev.za.net/filecloset/data/files/417/03.jpg
http://www.gamedev.za.net/filecloset/data/files/418/04.jpg
http://www.gamedev.za.net/filecloset/data/files/419/05.jpg
http://www.gamedev.za.net/filecloset/data/files/421/06.jpg
http://www.gamedev.za.net/filecloset/data/files/422/07.jpg
http://www.gamedev.za.net/filecloset/data/files/423/08.jpg
http://www.gamedev.za.net/filecloset/data/files/424/09.jpg
http://www.gamedev.za.net/filecloset/data/files/425/10.jpg
http://www.gamedev.za.net/filecloset/data/files/426/11.jpg
http://www.gamedev.za.net/filecloset/data/files/427/12.jpg
http://www.gamedev.za.net/filecloset/data/files/433/13.jpg
http://www.gamedev.za.net/filecloset/data/files/432/14.jpg
http://www.gamedev.za.net/filecloset/data/files/431/15.jpg
http://www.gamedev.za.net/filecloset/data/files/430/16.jpg
http://www.gamedev.za.net/filecloset/data/files/429/17.jpg
http://www.gamedev.za.net/filecloset/data/files/428/18.jpg
The zip file contains the seperate blocks, and a preview. the preview is a colored bunch, look below.
http://www.gamedev.za.net/filecloset/data/files/435/preview.jpg
╔╗╔═╦╗
║╚╣║║╚╗
╚═╩═╩═╝
Download them all here :
http://www.gamedev.za.net/filecloset/data/files/434/loltris_icons.zip
Kensei
05-04-2008, 04:05 PM
::groans::
I knew I should have checked the boards yesterday... Thanks FuzzySpoon, I might use your graphics (after I 'carefully' recreated dislekcia's graphics :D )
Right, update, I have completed as far as dislekcia got in his 2 pages. I'll be slowly tweaking the stuff so I can get at least one block falling (will create the Tetris blocks later)
Anybody want the GM file?
Tigman_1
05-04-2008, 08:07 PM
hey its a great tut. but I wanna know more >< I can't wait another 3 weeks lol, for the next issue. I have to have this game... or make it. Is there any way I can get the next 2 pages sneak preview :P ?
Kensei
05-04-2008, 08:55 PM
@Tigman_1: Why don't you try make it yourself?
So far I have individual blockies that fall down from the sky.
Gonna work on making the Tetris Blocks now ;)
FuzzYspo0N
05-04-2008, 11:19 PM
cool kensei :) glad someone liked the icons.
dislekcia
06-04-2008, 12:58 AM
@Tigman_1: Why don't you try make it yourself?
So far I have individual blockies that fall down from the sky.
Gonna work on making the Tetris Blocks now ;)
Win! Nicely done Kensei, why don't you share how you did it? I'm willing to give tips if people get stuck, but there are quite a few possible implementations that will produce a working Tetris, I'm keen to see what people come up with ;)
Tigman_1: Welcome to the forums, I'm sorry I can't release the next two pages early (contracts and all that) but I promise they'll be good when you get the next issue!
-D
Kensei
06-04-2008, 01:44 AM
Right, update. First Drafts (http://www.gamedev.za.net/filecloset/download.php?id=437)
Firstly, sorry to Tigman_1, I hurriedly read your post and failed to realize you are a fairly new member to the NAG forums. My apologies if I sounded harsh by saying 'Do it yourself' :(
I have created the Tetris blocks programatically.
I assumed, from dislekcia's screenshots that all the Tetris blocks are in fact created by the one sprite, FallingBlock. I am sure you can also create the blocks as sprites and then create each one as objects.
But I decided to create them all from FallingBlock.
Its a bit messy and the values for where the block is created is static (will change that soon :P )
This will be important when I want to start rotating the blocks.
Below is a picture of the starting point of each of the blocks that make up the shapes:
http://www.fotothing.com/photos/8f8/8f821e3e88623024ef48188308190f5a.jpg
Things I am having hassles with:
1. An adequate way of dropping the blocks (i.e. when you press the Down arrow)
- Increasing the down motion seems a bit messy
2. A good way to stop the blocks when they hit a static or boundary block (collision event?)
So what I have so far,
- Blocks that drop down from the sky
- At regular intervals it spawns a new block
- Shapes can move Left and right (with Boundary checks to make sure they don't escape :D )
- 'Melting' blocks -> i.e. because each of the shapes consist of FallingBlocks, each of them act independently, so each 15 x 15 block keeps going down until it hits a Static or Boundary block.
In retrospect, its probably a lot easier to create the shapes as sprites, the problem comes in when you need to make them into StaticBlocks.
EDIT: Tetris_1.gmk is what you would get if you followed all dislekcia's instructions in the magazine (bear in mind the game won't work yet :D )
Lastly, [phew, long post] to get a block to move downwards on the screen, in the Create Event of the FallingBlock Object, I added a 'Start Moving in a direction' and set the speed to 2
Kensei
06-04-2008, 02:48 PM
Forgot to add last night:
dislekcia: I think the 'image_blend' method is only in the Pro edition :( When I use it, it threw an error
dislekcia
06-04-2008, 04:02 PM
Whoa! Very nice Kensei :)
That's very, very close to how each shape's component blocks are created in my version, well done! I'd suggest keeping pointers to the various FallingBlocks each shape consists of and handling their movement, rotation and collision in the same place per shape. That will make your life much easier.
re image_blend: Are you using GM6.1 or GM7? I was under the impression that it was moved to unregged in 7. Hmmm.
-D
Tigman_1
06-04-2008, 04:36 PM
I am a bit new to game maker lol, kinda suck. But is your (Dislekcia) version gonna be awsom? cause another few days to wait....and i'll have the game >< (yay!)
Kensei
06-04-2008, 05:05 PM
Whoa! Very nice Kensei :)
That's very, very close to how each shape's component blocks are created in my version, well done! I'd suggest keeping pointers to the various FallingBlocks each shape consists of and handling their movement, rotation and collision in the same place per shape. That will make your life much easier.
re image_blend: Are you using GM6.1 or GM7? I was under the impression that it was moved to unregged in 7. Hmmm.
-D
Version 7.0 Lite - checked again, it definitely throws an error
For those stressing, the game will work find without the image_blend... well, at least mine does :D
@Tigman_1: Have you created the things as far as you can in the magazine?
I am a bit new to game maker lol, kinda suck. But is your (Dislekcia) version gonna be awsom? cause another few days to wait....and i'll have the game >< (yay!)
I am also new to Game Maker - ask the 'boys' here. I have made one game for one of their competitions - other than than I have been fiddling with sprites and doing the Game Maker tutorials (which are boring but teach some good lessons)
Tigman_1: Create the game up until the end of the part in the magazine and then we can show you how to create one blockie falling from the sky - even if you don't create Tetris, you can create a cute little game :D
Tigman_1
06-04-2008, 06:43 PM
I have already done the Tut in NAG ... but i'm lazy and want the answers for the 3rd + 4th page lol. but anyway i'll give it a bash , some help would be appreciated :)... ive also made 1 game so far, FTW hehe ><
FuzzYspo0N
07-04-2008, 12:17 AM
For those stressing, the game will work find without the image_blend... well, at least mine does
u can chop up those colored images, if u like. or request a color and ill hit you up..(4 colors) :)
Kensei
08-04-2008, 04:18 PM
Whoa! Very nice Kensei :)
That's very, very close to how each shape's component blocks are created in my version, well done! I'd suggest keeping pointers to the various FallingBlocks each shape consists of and handling their movement, rotation and collision in the same place per shape. That will make your life much easier.
Do you mean declare each of the objects that make up the shape as variables? (In the creation Event)
i.e.
Block1 = instance_create(105, 0, FallingBlock);
Then, when I want to transform the object (as in move it, not transform the Sprite)
You would do something like Block1.x -= 10 ?
Edit: Why yes, my knowledge of Game Maker is failing :D
dislekcia
08-04-2008, 05:23 PM
Do you mean declare each of the objects that make up the shape as variables? (In the creation Event)
i.e.
Block1 = instance_create(105, 0, FallingBlock);
Then, when I want to transform the object (as in move it, not transform the Sprite)
You would do something like Block1.x -= 10 ?
Edit: Why yes, my knowledge of Game Maker is failing :D
Ding! Yes, that's exactly what I mean :)
-D
Jeronkey
11-04-2008, 12:32 PM
Started fiddling to see if I could get anywhere, and thanks to you and Kensei I've gotten somewhere. :)
Collisions are proving tricky though, I can't think of a good way to do them. Any tips?
And lastly, thanks for the lovely article dislekcia, I learnt a few things~
(For instance, I had no idea the "choose" command existed. Thats awesome!)
Kensei
13-04-2008, 12:06 PM
@Jeronkey: At the moment I have a Collision Event that when an instance of a FallingBlock collides with an instance of a StaticBlock, it destroys the instance of the FallingBlock...
It is not ideal - as I now have 'melting' blocks :D
But it will do until I figure out how to rotate the blocks adequately.
dislekcia
13-04-2008, 04:28 PM
I'll give you guys a hint: Don't use GM's standard movement (ie: Move in a direction isn't a good idea) and make liberal use of place_meeting() to test for collisions ;)
-D
Kensei
13-04-2008, 06:12 PM
^ Oooh :D Thanks, dislekcia, this actually helps a lot :D
This will make collision checks a lot easier :D
Kensei
15-04-2008, 04:59 PM
Right, after a discussion with a friend I realized what might be the key to making these blocks rotate...
Specifically it involves using vectors and transformation matrices... Now, if only I could remember how to do it programmatically...
dislekcia
15-04-2008, 07:19 PM
Right, after a discussion with a friend I realized what might be the key to making these blocks rotate...
Specifically it involves using vectors and transformation matrices... Now, if only I could remember how to do it programmatically...
You don't need vectors or matrices, that's making it all far too complicated!
You could use trig and a distance from a centre point, in which case lengthdir_x() and lengthdir_y() are your friends...
Or you could simply have 4 possible states for each shape to be in:
if (dir == 0) {
block1.x = ...;
block1.y = ...;
...
block4.y = ...;
}
if (dir == 90) {
...
}
...
if (dir == 270) {
...
}
-D
Kensei
16-04-2008, 01:02 AM
^^ That was my original plan (i.e. 4 directions)
I might try that way first because I fear my research is failing me
Thanks
Evil_Toaster
16-04-2008, 02:48 AM
Here be some ET sneakies from the past:
Rotations, without the trig
for x := 0 to 3 do begin
for y := 0 to 3 do begin
newpiece[-y,x] = oldpiece[x,y];
end;
end;
The above should rotate the array by 90 degrees, but will give rotations which are a little wonky (not rotating around the piece's center). There's better ways, but this is great to get it operational initially.
Collisions, the lazytastic way
Apply an action temporarily (rotation, movement, etc). Map the block to its corresponding location on the grid and compare each point. If in any case, both values are non zero, a collision has occured, and you should not allow the movement/rotation, or lock the piece in place. If no collision, commit the action.
dislekcia
16-04-2008, 03:00 AM
You could use the old -y,x trick to rotate around the centre by using relative co-ordinates from the centre of the piece...
ie: The blocks are positioned accordingly...
block1.x = parentPiece.x + block1.xoffset;
block1.y = parentPiece.y + block1.yoffset;
then to rotate the block around the piece, all you do is this:
temp = block1.xoffset;
block1.xoffset = -block1.yoffset;
block1.yoffset = temp;
-D
Evil_Toaster
16-04-2008, 03:11 AM
You could use the old -y,x trick to rotate around the centre by using relative co-ordinates from the centre of the piece...
ie: The blocks are positioned accordingly...
block1.x = parentPiece.x + block1.xoffset;
block1.y = parentPiece.y + block1.yoffset;
then to rotate the block around the piece, all you do is this:
temp = block1.xoffset;
block1.xoffset = -block1.yoffset;
block1.yoffset = temp;
-D
I see your rotation trick offset upgrade and raise you a blatant lie.
I once coded a 99.9532% accurate 3D physics system which made actual coffee and worked out my tax over a lunch break using only my left shoe! Sadly, the office caught fire soon after that, and I haven't been able to find that brand of shoe again.
dislekcia
16-04-2008, 03:14 AM
I see your rotation trick offset upgrade and raise you a blatant lie.
I once coded a 99.9532% accurate 3D physics system which made actual coffee and worked out my tax over a lunch break using only my left shoe! Sadly, the office caught fire soon after that, and I haven't been able to find that brand of shoe again.
I have a suspicion that you're bluffing... But I'll see that outright lie and raise you a questionable halftruth!
In a previous life I may or may not have had access to an API which allowed me so little control that all code had to be written in proxy, line-by-line via a set of VBscript files!
-D
Evil_Toaster
16-04-2008, 03:19 AM
I refuse to concede that I'm not pretending to admit that I might never sometimes fail to occationally always bluff.
dislekcia
16-04-2008, 03:21 AM
Well played sir. Well played.
I didn't know you used to could have going to were a gambling man.
-D
Kensei
16-04-2008, 02:41 PM
Thanks for the input ET, always honoured to have you give your input :D
It seems this is a common way to do the rotations in Tetris, i.e. to do the rotations without trig and then to compare if a collision has occurred not.
I will make another attempt at this when my head clears from its cobwebs (damn hangovers)
Tigman_1
29-04-2008, 10:17 PM
Hi there, I have followed the tut. in the May edition but I get this error when I try to load the game:
"ERROR in
action number 1
of Alarm Event for alarm 1
for object TetrisBlock:
Error in code at line 2:
for (i = 0; i < numBlocks; i += 1) {
at position 18: Unknown variable numBlocks"
could I please get some help...cause i checked it and it seams write.
dislekcia
30-04-2008, 02:11 AM
Hi there, I have followed the tut. in the May edition but I get this error when I try to load the game:
"ERROR in
action number 1
of Alarm Event for alarm 1
for object TetrisBlock:
Error in code at line 2:
for (i = 0; i < numBlocks; i += 1) {
at position 18: Unknown variable numBlocks"
could I please get some help...cause i checked it and it seams write.
Are you using the first Tetris tutorial (last month's article) as your starting point? If you are, chances are you misspelled the "numBlocks" variable in your Create Event :)
-D
Tigman_1
30-04-2008, 02:35 PM
ya i am using last months issue for the start, i'll check it out when i can ... i'll get back to you (thanks so far)
Tigman_1
30-04-2008, 04:12 PM
it works :) yay, but I run into a new problem now :(
when I rotate the block (up arrow) it goes all jerky and weird and also I need game maker pro to use the blend image :( any solutions ?
Any suggestions? and I think the tutorial was EXCELLENTE (French Voice)
FuzzYspo0N
30-04-2008, 09:32 PM
game maker is like 150 bucks :D its so worth paying for i rate.
dislekcia
01-05-2008, 02:00 PM
it works :) yay, but I run into a new problem now :(
when I rotate the block (up arrow) it goes all jerky and weird and also I need game maker pro to use the blend image :( any solutions ?
Any suggestions? and I think the tutorial was EXCELLENTE (French Voice)
Heya, so it was just a spelling error then?
The image_blend line can be commented out and the game will still work fine, it'll just be rather grey :( You could make multiple different sprites with different colours (as long as they're the same size) and change the sprite_index of the FallingBlocks as they're created if you want. That should work fine.
Please explain the jerkyness/weirdness, what happens exactly? I think that could be a spelling error or typo in the the Up Released event on TetrisBlock, as mine doesn't do that here.
-D
Tigman_1
01-05-2008, 07:36 PM
ummm, ive taken a screen shot (and put it on my aviator cause i couldnt figure how to upload the image) (bit distorted so dont worry) also any idea how to replace the sprites ? cause ive made the the different colour sprites but how do i load them? Thanks so much so far
dislekcia
01-05-2008, 10:57 PM
ummm, ive taken a screen shot (and put it on my aviator cause i couldnt figure how to upload the image) (bit distorted so dont worry) also any idea how to replace the sprites ? cause ive made the the different colour sprites but how do i load them? Thanks so much so far
You can post images by uploading the image to http://www.imageshack.us and then putting img tags around the url you get from imageshack...
<img>http://www.imageshack.us/randomnumbers_and_stuff/blah.jpg</img>
//Replace < with [ and > with ]
To change the sprites, all you need to do is add an Alarm 1 event to each different block (like LBlock, SBlock, etc) in which you:
1. Call the inherited event, and
2. Stick in this code:
for (i = 0; i < numBlocks; i += 1) {
blocks[i].sprite_index = <name of your different coloured sprite>;
}
Be sure to use different coloured sprites for each type of block. If you spell the name right, it should go purple to show that it's a type and not a variable.
-D
Tigman_1
02-05-2008, 01:26 PM
Thanks, I have it all sorted out except for 3 things :
1) When the block reaches the bottom it disappears instantly (destroys itself before it can form a entire row.
2) The square cannot line up against the left or right wall :( (im thinking its the spawn positioning so i'll whork on that hopefully)
3) When I press the up arrow the block jumps to the left (about 2X its length) then if I press it again it just turns into 2 diagonal blocks , then if i press it again a third time, it just jumps back to the right (about in line where it started) and this time its reflected (facing opposite side) which is not rotating :(. And it can jump outside the left or right wall .... which it then destroys itself...
please help....
Tigman_1
02-05-2008, 02:22 PM
Im actually going to start again, this time i'll see how it turns out cause its turned into a mess...
dislekcia
02-05-2008, 04:15 PM
Sounds like problems came in with copying the various scripts... I know there was a ton of text (and it's very small in the magazine) with the Tetris example, but try to make sure that you do things like match cases and keep variable names consistent. When you see a similar word in a similar situation, chances are it's the same variable and needs to be spelled exactly the same to work right.
-D
Tigman_1
02-05-2008, 04:38 PM
Gonna copy it word for word, letter for letter, space for space :P
I'll get back to and let you know how it goes, also just a question, you said (for the image_blend) that i must create a alarm 1 and inherit event and make that script. What am I meant to do about the Create event in each block ? also must I delete all image blend lines?
dislekcia
02-05-2008, 05:18 PM
Gonna copy it word for word, letter for letter, space for space :P
I'll get back to and let you know how it goes, also just a question, you said (for the image_blend) that i must create a alarm 1 and inherit event and make that script. What am I meant to do about the Create event in each block ? also must I delete all image blend lines?
Leave the create events as they are, you can't set the sprites there because the FallingBlocks are only created in the inherited alarm 1 event :)
Simply comment out all the lines with image_blend in them (put // in front of each line) and it'll work fine.
-D
Tigman_1
02-05-2008, 06:46 PM
thanks so far, but if you look at last months issue, specifically at FallingBlocksSpr. it says:
static = instance_create(x, y, StaticBlock);
static.image_blend = image_blend;
now is there any way that i can re-write that but not change my sprite to staticblock. Cause ive made all my blocks 3D and i don't wont them the same colour.... anyway so can i instance_create my same image?
Probleme No.2 is that how to i re-write the second line using
for (i = 0; i < numBlocks; i += 1) {
blocks[i].sprite_index = <name of your different coloured sprite>;
}
thanks for all the help so far much appreciated :) (noobi going pro)
dislekcia
03-05-2008, 12:06 AM
thanks so far, but if you look at last months issue, specifically at FallingBlocksSpr. it says:
static = instance_create(x, y, StaticBlock);
static.image_blend = image_blend;
now is there any way that i can re-write that but not change my sprite to staticblock. Cause ive made all my blocks 3D and i don't wont them the same colour.... anyway so can i instance_create my same image?
Probleme No.2 is that how to i re-write the second line using
for (i = 0; i < numBlocks; i += 1) {
blocks[i].sprite_index = <name of your different coloured sprite>;
}
thanks for all the help so far much appreciated :) (noobi going pro)
Ah, that's not FallingBlockSpr, that's in the Destroy event on FallingBlock ;) fallingBlockSpr is the sprite used for the blocks...
All you need to do is change the second line there to:
static.sprite_index = sprite_index;
That will make the StaticBlock you're creating to replace the FallingBlock have the same sprite as you've given the FallingBlock. Simple :)
-D
Tigman_1
03-05-2008, 12:57 AM
Well thanks so far, everything works so far except 3 more things >< so close.
1) my rows don't build up for some odd reason, they just replace each other :( any help? (2 rows high is my maxiumum because they replace each other...)
2)My Z;S;Square blocks can crash into the side walls and sit there >< almost as if they not rebeling against the wall
3)My square cant line up with the wall, its origan 7,5 off from the centre of the spawn
some help please....
dislekcia
03-05-2008, 02:35 AM
Well thanks so far, everything works so far except 3 more things >< so close.
1) my rows don't build up for some odd reason, they just replace each other :( any help? (2 rows high is my maxiumum because they replace each other...)
Are you sure that you checked the Solid checkbox on StaticBlock? (And on BoundaryBlock, for that matter)
2)My Z;S;Square blocks can crash into the side walls and sit there >< almost as if they not rebeling against the wall
Again, are the BoundaryBlocks solid? Go over the keypress actions in TetrisBlock to see if that's working as it was printed...
3)My square cant line up with the wall, its origan 7,5 off from the centre of the spawn
some help please....
I don't understand why you're talking about origins of blocks... Post your .gmk please?
-D
Tigman_1
03-05-2008, 08:08 AM
Well both are solid yes...so I don't know, gona check it a 5th time lol...
what im saying about da block, heres a screeni:
http://img247.imageshack.us/img247/3127/screanigm6.th.jpg (http://img247.imageshack.us/my.php?image=screanigm6.jpg)
just click on it to enlage, thanks so far ><
Here's my file, see what you can do, please get back to me as soon as possible >< (soon please I cant take this waiting >< and thanks for all the help so far)
http://www.filefactory.com/file/4a669d/
(Sorry couldn't get imageshack to work...)
(also how would you make the highscore table show using it in the scripts? Cause i want to add it, when the game says "gameover!" so you can fill in ur name. And i have already set values ect on my rows and blocks...)
Tigman_1
03-05-2008, 03:13 PM
just sorted out the sqaure problem, so no worries abot that...
only 2 more probs :)
dislekcia
03-05-2008, 05:11 PM
Ok, just looked through your code, most of the problems were just from having to deal with the very small pictures this issue... Sorry about that.
The SquareBlock alignment problem:
In the Create event, add in the following lines to move the block's centre left and down slightly.
x += 7.5;
y += 7.5;
I remember doing this to fix the square's rotation, otherwise it would flip around the top left block and look really ugly. That didn't appear in the pictures in NAG due to me screwing up, you can see the scrollbar on the left of the SquareBlock code segment :(
Blocks interpenetrating:
Just set StaticBlock's parent attribute to BoundaryBlock. You'll notice that collision checks are only done against BoundaryBlock, so we need to make StaticBlocks part of that check using parenting :)
Blocks going into the sides:
Typo in the TetrisBlock left and right keypress events. In the first for loop it reads "with (blocks[1]) {" that should be "with (blocks[i]) {" because otherwise it will only check the second FallingBlock in the array, meaning that only that block can collide with the sides, which doesn't work too well as you can see ;)
Adding a score counter:
The best place to add a score counter is in the CheckForCompleteRows script. All you need to do is increase a global score variable inside the part that clears a row: The "if (!gapFound) {" section.
-D
Tigman_1
03-05-2008, 05:17 PM
Thanks SOOO much, it was a great tutorial , but just three questions: (which you dont have to answer but i would love them answered)
1) how do i make it so that, when i press the down arrow, it moves down instead of jump down, I was thinking , making the room speed increase by 30 and then when i release the down key it decrease the room speed RELETIVE to what the speed already is because I am adding levels and at certain levels the speed is different.
if there where a way to type this : "room_speed = 30" but make it reletive, please tell me
2) how do I make a timer, so it tells you how long you have been playng for (like a stop watch)
*3) how do I make the score appear under the clock.*
The * questions are the most important to me, and if you answer them, i'll have a good nights sleep :)
dislekcia
03-05-2008, 06:18 PM
I'm not going to make this quite as easy for you as the other questions, but I like that you're extending the game, that's awesome :)
1. At the moment, when you press the down arrow it just repeats the block's normal movement step (which moves the block down) until it collides with something. To make it simply move down down twice as fast, just repeat the step event twice and chance the keypress event to a normal key event (key events fire every frame, instead of just once when the key is pressed).
There's also an easy way to change the speed that the blocks move down with. I'll give you a hint: It's in the Control object. See if you can find it ;)
To make a variable change "relatively" all you need to do is add or subtract something to that variable itself, so you can do things like "room_speed = room_speed + 30;" for instance. Although I'd suggest against messing with the room speed to try and make the game faster. That's how many frames per second the game tries to run at, sometimes a really complex game won't manage to run at 60 frames per second on a slower computer, so try to use other methods. Like changing how far the blocks fall each step... (another clue)
2. There are lots of methods to get the time in Game Maker. You could grab the current time when the game starts and store that in a variable, then every frame all you need to do is get the new time and subtract the starting time. That will give you how much time has passed... Look up current_time and "time functions" in the GM help for ways of getting the time.
3. To draw text, create a new object and use a draw_text() command in that object's Draw event. Remember to set the font and colour you want the text to be in before you call draw_text(). You may need to create a new font, that shouldn't be too hard.
4. (Four? Yeah!) How about adding a "next block" view so that people can plan 1 drop ahead?
-D
Tigman_1
03-05-2008, 08:02 PM
Please just tell me how to increase the speed like every 2 minutes, I'm a noob :P thats all i ask *please* DESPRATLY NEED TO KNOW PLEASE PLEASE
I just need to know how to do 2 minute intervils and every 2 minuts the speed increase, I tried the fallingSpeed but all it did was made the block blury and jagedy....and the room speed seams to be alot smoother...
Tigman_1
04-05-2008, 05:29 PM
I have tried using steps , every 3555 steps = 2minuts, but when i increase the room speed the steps are going to change >< speed so its hard ... but if i increase the block speed (in control) the block gets slightly jerky which isnt helpful. Is there anyway to make a 2 minute intervil clock thing without using steps ?
dislekcia
05-05-2008, 02:42 AM
I have tried using steps , every 3555 steps = 2minuts, but when i increase the room speed the steps are going to change >< speed so its hard ... but if i increase the block speed (in control) the block gets slightly jerky which isnt helpful. Is there anyway to make a 2 minute intervil clock thing without using steps ?
Like I said. Use the time functions in GM... There's a really big reason I'm pointing you to the GM help ;)
-D
Tigman_1
05-05-2008, 05:41 PM
ive looked cant find it lol
Tigman_1
05-05-2008, 06:57 PM
Stuck Stuck Stuck And Stuk
dislekcia
05-05-2008, 08:15 PM
ive looked cant find it lol
F1. Click on Index. Type "time functions" ... ?
-D
Tigman_1
05-05-2008, 08:43 PM
so how would i type it to say every 2 minuts do X (i'll fill in X)
Tigman_1
06-05-2008, 06:06 PM
Spell it out *please* , pretty with a cheery on top?
dislekcia
06-05-2008, 07:47 PM
Spell it out *please* , pretty with a cheery on top?
Half of what I do is encourage people to start thinking in ways that help solve problems... So I'm not going to simply give you an answer, I want you to do some experimenting so that you'll have a base to work on next time you run into a problem that needs solving ;)
So. Have you seen what those commands output just yet? Have you tried any of them? Surely the ones that talk about getting seconds or minutes should give you some ideas...
-D
Chippit
06-05-2008, 08:04 PM
dislekcia has achieved level 34 Resolve!
Tigman_1
06-05-2008, 08:23 PM
ive read dem all like 1000 times but it makes no peace with me,,,
ive started : date_create_time(12, 00, 00)
then I dont know what to do which one else to use ? is it meant to look like this:
date_create_time(12, 00, 00){
date_get_second(60)
room_speed = 40
}
what? I know what your thinking (it doesn't work I know...) please would you PLEASE PLEASE PLEASE Help O_O
It would be so great if I could play da proper game by Thursday :)
dislekcia
06-05-2008, 08:35 PM
You don't need to set the date. You need to store what the get time functions return...
anAmountOfSeconds = date_get_second();
... what do you think that would do? ;)
-D
Tigman_1
07-05-2008, 07:29 AM
I don't KNOW please just give me the correct line ...is it like this:
date_get_second(120)
room_speed = 40
if not please give me the correct answer IM DYING HERE !!!
dislekcia
07-05-2008, 09:33 AM
I don't KNOW please just give me the correct line ...is it like this:
date_get_second(120)
room_speed = 40
if not please give me the correct answer IM DYING HERE !!!
Ok, you're not understanding something... In programming it's very common to use variables to store information. Certain functions will return a value, meaning that they give you some sort of result or answer, rather like a mathematical function. date_get_second() is one of those kinds of functions. That means that instead of giving it a parameter and typing date_get_second(value) you need to store what the function returns by using the form variable = date_get_second(). This will store the current second value of the time into the variable, which you can then compare to some other value using an if statement...
if (variable == something) { //do stuff, like change the room speed, etc }
Clearer?
-D
Kensei
07-05-2008, 12:01 PM
Now that I have arrived and kinda settled in London, I will take another look at this Tetris thing :)
Tigman_1: Good luck with the problem - use your head, you can do it!
Tigman_1
07-05-2008, 06:22 PM
Thanks i'll try my best , this is like Latin to me... gotta start somewhere...
Tigman_1
07-05-2008, 06:27 PM
CONFUSED ?
dislekcia
07-05-2008, 06:39 PM
TimeLine = date_get_second(10)
Why is that 10 there? Does it say that there should be something there in the helpfile? What do you think that 10 would do?
if (TimeLine == TimeLine) {
Think carefully about this... You're saying "If a thing is equal to itself, set the room speed to 90". Would that make sense to you if someone told you to do that? What would it make more sense to ask if you were using an "if" question?
room_speed = 90;
}
-D
Tigman_1
07-05-2008, 06:43 PM
Look ive been waiting 2 months now, typed the game 5 times, all I want is that 1 command line that I don't understand so that I may finish my butiful game. Please Please Please just give me the answer with an explination.... Please ><
:)
Tigman_1
07-05-2008, 06:49 PM
What would it make more sense to ask if you were using an "if" question?
Umm if Timeline == 120 seconds set room speed 40?
Kensei
07-05-2008, 06:56 PM
If I understand what you are asking, you need something to happen every 2 minutes, right?
So, why don't you put in some code that tests the amount of seconds that have elapsed since last check.
e.g. anAmountOfSeconds = date_get_second();
if(anAmountOfSeconds == 120){
Dosomething();
Reset seconds counter
}
Chippit
07-05-2008, 06:58 PM
Now you're getting closer.
Note that your 'timeline' variable isn't storing the difference in time since the last speed change; it's storing the current seconds time.
Tigman_1
07-05-2008, 07:09 PM
What do you mean by :
"anAmountOfSeconds"
ok, this is what I want it to do:
for every 2 minutes that pass by I want the room speed to increase by 10...nothing that difficult is it?
ummm I am really confused and don't know what is going on... so please, if you answer my question start from scratch and explain to me whats happening also give me the answer PLEASE (bergy kind of way lol)
Tigman_1
07-05-2008, 07:11 PM
Now you're getting closer.
Note that your 'timeline' variable isn't storing the difference in time since the last speed change; it's storing the current seconds time.
i have no timeline must I add 1 , REALY CONFUSED MANI-ACK HERE PLEASE DESPERATE bullet step guid like so:
1)....
2)....
3)....
Anilihst
07-05-2008, 08:52 PM
Why are you bothering with the date time if an alarm relative to the room speed would make the script compiling a lot less. Even is it was a precompiled game I would stil have gone with this option. Am I mistaken on this?
Kensei
07-05-2008, 08:54 PM
What do you mean by :
"anAmountOfSeconds"
ok, this is what I want it to do:
for every 2 minutes that pass by I want the room speed to increase by 10...nothing that difficult is it?
ummm I am really confused and don't know what is going on... so please, if you answer my question start from scratch and explain to me whats happening also give me the answer PLEASE (bergy kind of way lol)
anAmountofSeconds is a variable - I don't mean to sound condescending but you do know what a variable is, right?
I will look at this problem either tonight or tomorrow.
For homework: Look at how the Step function and then how to check how many seconds have elapsed (must be one of those time functions -I am not sure which one it is)
Tigman_1
07-05-2008, 09:08 PM
Ive tried the step functions but they dont work :( because:
when the room step is at 30 , it takes (i think) 3600 steps in 2 minuts, then when you increase the speed say to 40, so does the steps, so the formula "no. of steps X seconds = time " if you get that but because the room is going faster it aint working :(
i have tried doing this:
at (in a timeline) 3600 steps, increase speed to 40, then play timeline 2
4800 steps, increase speed to 50
but this doesnt work for some reason thats why I wanted to know if you could make like a 2 minute alarm NOT using steps...?
dislekcia
07-05-2008, 09:21 PM
What would it make more sense to ask if you were using an "if" question?
Umm if Timeline == 120 seconds set room speed 40?
That's really, really close. Well done!
Now you're thinking logically :)
But there's one more thing you need to do, Kensei touched on it. Basically, the problem is that you need to find out how many seconds have passed since you last set the speed... How would you do that if you were, say, staring at a clock?
-D
P.S. I think the reason your multiple timeline idea didn't work is because you were setting "speed" and not "room_speed"... "speed" is a property that each object in GM has, if you were using the Set Speed drag and drop action, that will only change how far that specific object moves in each step. You need to change the value of the special variable "room_speed", which tells GM how many steps it should try to have in a second.To do that you could use the Set Value of a Variable action, or type out the code manually in a Execute Code action.
Tigman_1
07-05-2008, 10:09 PM
no I was using room_speed
Tigman_1
07-05-2008, 10:13 PM
well I have this so far in the "time" object:
if(Time2 == 120){
room_speed = room_speed +10;}
any idea what to write in the Time2 object script? Maybe like start counting to 120? but how
Anilihst
07-05-2008, 10:41 PM
Dis will you please comment on my theory, I just want to know if my reasoning is correct.
dislekcia
08-05-2008, 04:02 AM
Why are you bothering with the date time if an alarm relative to the room speed would make the script compiling a lot less. Even is it was a precompiled game I would stil have gone with this option. Am I mistaken on this?
Yes, an alarm set to multiples of the current room speed would work. But only up to a point: At some point your speed is going to max out (hit the fastest that the game can be updated on the current hardware) and the you're going to have to wait longer and longer than the allotted time period for a speed increase (which wouldn't really show anyway if it had maxed out, but that's not the point)...
I really don't understand why you're talking about script compiling... The amount of "extra" work required to handle the get time function is pretty negligible, there's very little reason to bother trying to optimise to that level. Chances are you won't even feel it if the game is running as fast as it possibly can.
-D
Anilihst
08-05-2008, 08:20 AM
Thx Dis. I wasn't going to use this method I just wanted to know if it would work.
About the compiling speed thing I was just saying that if you have choice between using a built in function or write one yourself which does the same thing rather use the built in one since gml is much slower than compiled code. Does that make sense?
I like to take even the small things into consideration because if you start doing sloppy programing it will just get worse. (I don't want wirth's law to apply to me)
Anilihst
dislekcia
08-05-2008, 03:49 PM
About the compiling speed thing I was just saying that if you have choice between using a built in function or write one yourself which does the same thing rather use the built in one since gml is much slower than compiled code. Does that make sense?
I like to take even the small things into consideration because if you start doing sloppy programing it will just get worse. (I don't want wirth's law to apply to me)
No, GM's scripts aren't much slower than its function calls... Many of the function calls simply run a series of script commands anyway. In my years and years of using the engine, I haven't noticed that scripting slows my games down in any way. In fact, these days I tend to write everything as scripts instead of using the built-in functions.
I understand where you're coming from, but I think that your concern is something that will stunt future programming growth: You don't want to discard or otherwise no use an elegant algorithm because you're worrying about something that won't even affect your performance in any way. That's similar to the crippling optimisation cycles that people get stuck in when they're writing engines: You end up sitting there trying to make one tiny part a little faster and never finishing a game at all.
Your first priority should be to make the game work, no matter how sloppy it might be, then go back and optimise only if you need it and even then, only in the sections that are slowing down the game the most... Sure, you want to make good decisions early on in your approach to certain problems to make your life easier later, but that's mainly just experience and managing to keep things as modular as possible.
-D
dislekcia
08-05-2008, 03:51 PM
well I have this so far in the "time" object:
if(Time2 == 120){
room_speed = room_speed +10;}
any idea what to write in the Time2 object script? Maybe like start counting to 120? but how
Why are you saying that Time2 should be an object?
What you want to do is have a variable that will store how much time has passed since the last time you reset the speed. That's what you need to figure out how to do... My previous question (about the clock and how'd you do it in real life, not code) was designed to help you do just that ;)
-D
Tigman_1
08-05-2008, 06:52 PM
well I think for a start what on earth is a vairiable ????
dislekcia
08-05-2008, 07:58 PM
well I think for a start what on earth is a vairiable ????
There we go :)
Ok, a variable is a "holder" for information.
For instance, in GM we might want to store a player's name so that we can tell them how awesome they are when they finish a level. To do that we'd need to get the player to enter their name and then STORE that name somewhere for later use...
Something like:
playerName = "Guest";
stores the string Guest in the variable playerName. If we output the variable:
draw_text(10, 10, "The player is called: " + playerName);
We'd see Guest appearing at the position 10, 10 in our game room...
Now if we wanted to let the player type in their own name, we could change the contents of playerName by getting that info from the player:
playerName = get_string("What's your name?", ""); (look up that command in the help to see what it does!)
And the player typed in SuperKiller2300, then after that line had finished executing, playerName would be "SuperKiller2300" and not "Guest" anymore. And our draw_text() code up above would show SuperKiller2300 without needing to be changed at all!
That's powerful. A variable doesn't just have to be a string either, it can be a number or even a specific instance of an object or an object type. There's a lot you can do with variables, but essentially, variables are there to let your game "remember" things from one second to the next.
-D
Tigman_1
08-05-2008, 08:08 PM
ok, so how do I make a variable remeber to count to 120 and then do X and the reset the timer?
if(Time == 120){
room_speed = room_speed +10;}
(time is no object or anything)
kinda confused, i get what your saying but kind of confused, a 100th clue maybe?
dislekcia
08-05-2008, 08:53 PM
ok, so how do I make a variable remeber to count to 120 and then do X and the reset the timer?
if(Time == 120){
room_speed = room_speed +10;}
(time is no object or anything)
kinda confused, i get what your saying but kind of confused, a 100th clue maybe?
That's why I asked how you'd do that if you were using a clock in real life to time something every two minutes. What would you have to remember? What would you have to do at the two minute mark?
Answer those and the logic will fall into place :)
-D
Tigman_1
08-05-2008, 09:03 PM
if(Time == 120){ *reset the variable....thats what I would do ?
room_speed = room_speed +10;}
instance_destroy(time1)
instance_create(15,15,time1)
woud that work? cause it sounds to me like it would work
dislekcia
09-05-2008, 01:20 AM
if(Time == 120){ *reset the variable....thats what I would do ?
room_speed = room_speed +10;}
instance_destroy(time1)
instance_create(15,15,time1)
woud that work? cause it sounds to me like it would work
You're not answering the question ;)
How would you do that in real life if you were looking at a clock? Explain it to me. C'mon.
-D
Higushi
09-05-2008, 01:23 AM
random, but helpful:
room_speed = room_speed + 10; can also be written like this:
room_speed += 10;
Tigman_1
09-05-2008, 03:13 PM
So this is what i have so far :
if(Time == 120){
room_speed = room_speed +10;}
now in real life I would say,"I have a english project....no jokes :)."
now to business, " Ok 2 minutes have been. Time to set my room speed +10 next I want to stop my stop watch, press reset, and go! (all in the time of 1 split second)"
a second option i could do is,"add 120 to 120 then add 120 ..... till im in the thousands next, (lets say the letter "P" = room_speed = room_speed +10. I'll run my game and my stop watch... when my watch reaches 120 (pre written on paper) I will press "P", then when my watch reaches 240 I will press "P" and so on the cycle goes"
I think that would work in real life, especially the second option. So what you think dislekcia, my padawan....
P.S is this correct at all?: (the bellow is in an object, by the name Time, in a create event and a script, it is trigered by the control object by instance_create(15,15, Time) and it does trigger the object, I tested it)
if(Time == 120){
room_speed = room_speed +10;}
dislekcia
09-05-2008, 04:28 PM
Ok, so how would you know when 2 minutes had gone by? Explain how you'd use the stopwatch and what you'd have to remember...
-D
P.S. No, your Time object thing doesn't make any sense at all. GM stores object types as numbers above 10000, so your code will compile but never execute the room speed increase. All that you'll get is something like if (10003 == 120) {, which will clearly never be true ;)
You're fixated on this object approach, trust me when I say you need to think like you're physically looking at a clock.
Tigman_1
09-05-2008, 06:48 PM
Ahhhhh.... so what i have done in the control object, in the create event, I put a Alarm 2 to 1 step, so that it activates instantly when the game starts.... then what I have done is made a Alarm2 event...in that I put a script saying:
if (Alarm3 == 120){
room_speed = room_speed +10;}
(please tell me if the above is right)
now what I think I should do is make a Alarm 3 event but what would I put in its scripts...? (please tell me if I am on the right track)
now to answer your question:
I would stare at my watch, knowing / remembering that if it gets to 120 seconds I must set the room speed +10...and then reset my self so that I can do it again?
but what would tell me that 120 seconds have gone by?hmmmmm....:)
am I on the way to the bar of '"GOLD"'?
Higushi
09-05-2008, 09:16 PM
Ahhhhh.... so what i have done in the control object, in the create event, I put a Alarm 2 to 1 step, so that it activates instantly when the game starts.... then what I have done is made a Alarm2 event...in that I put a script saying:
if (Alarm3 == 120){
room_speed = room_speed +10;}
(please tell me if the above is right)
now what I think I should do is make a Alarm 3 event but what would I put in its scripts...? (please tell me if I am on the right track)
Alarms count down, not up. So (Alarm3 == 120) does not make sense. You only need to use one alarm for what you are trying to do, you simply need to make it loop (repeat) itself. Think about it.
You are on the right track with the control object setting the alarm to 1 to start it off, you could also call the alarm's event to make it even more instantaneous. :)
event_perform(ev_alarm,0) - Runs the event of alarm0
Tigman_1
09-05-2008, 09:58 PM
great, so I have this in my object script...
fallingSpeed = 1;
event_perform(ev_alarm,2)
I would stare at my watch, knowing / remembering that if it gets to 120 seconds I must set the room speed +10...and then reset my self so that I can do it again?
so I think what i need to do is add something to alarm 2? What Nostrick said that alarms count down... do what could I make to count up..
this is what I have in my alarm 2 event :
if (Alarm2 == 120){
room_speed = room_speed +100;}
now I know Alarm2 is not a variable because it isn't purply colour. so what could I do. I feel im getting close because the control activates the alarm... now all what I need is for the alarm to remember to do something in 120seconds...then I can reset it...am I know close to the POT OF GOLD?
01DT!m3r
10-05-2008, 06:20 PM
Why dont you just say . If variabletime <120 {room_speed += 10; variabletime = 0 ; } and every step set variabletime relative to 1 ?
Tigman_1
10-05-2008, 06:42 PM
I cant use steps you see, I can only use time in seconds...you see but can anyone anser this :
great, so I have this in my object script...
fallingSpeed = 1;
event_perform(ev_alarm,2)
I would stare at my watch, knowing / remembering that if it gets to 120 seconds I must set the room speed +10...and then reset my self so that I can do it again?
so I think what i need to do is add something to alarm 2? What Nostrick said that alarms count down... do what could I make to count up..
this is what I have in my alarm 2 event :
if (Alarm2 == 120){
room_speed = room_speed +100;}
now I know Alarm2 is not a variable because it isn't purply colour. so what could I do. I feel im getting close because the control activates the alarm... now all what I need is for the alarm to remember to do something in 120seconds...then I can reset it...am I know close to the POT OF GOLD?
Tigman_1
10-05-2008, 07:49 PM
I have no idea how to do this, I have posted over 20 times just to get to this 1 command! what I need to do is : every 2 minutes set the room speed +10
Now can someone please just tell me how to do it, I have looked to the end of the world for it! Please someone just tell me !!!!!
Tigman_1
10-05-2008, 08:00 PM
Look this is what I have got:
variabletime = 1;
if variabletime < 120 {room_speed += 10; variabletime = 0 ; }
but my only problem that it changes the room speed instantly is their something wrong with it?
Thaumaturge
10-05-2008, 08:20 PM
Well, read what you wrote: "if variabletime < 120, do something, and set variabletime to 0".
What does "if variabletime < 120" mean? When is it true?
I would stare at my watch, knowing / remembering that if it gets to 120 seconds I must set the room speed +10...and then reset my self so that I can do it again?
That sounds about right to me - except that the statement that you'd reset yourself is not entirely accurate - I imagine that somewhere you'd be keeping track of the amount of time that has elapsed, and that, I think, you'd reset...
Higushi
10-05-2008, 08:56 PM
I do not mean any offense, but I really think you should get a hold of some tutorials. Perhaps go through the beginner GM tuts and then find a little more advanced ones, if you do, these types of problems shall become a peice of cake.
Tigman_1
10-05-2008, 08:58 PM
thanks, but im still confused , if some1 could just please give me the FULL answer
Tigman_1
10-05-2008, 08:59 PM
I do not mean any offense, but I really think you should get a hold of some tutorials. Perhaps go through the beginner GM tuts and then find a little more advanced ones, if you do, these types of problems shall become a peice of cake.
thanks i'll try dat
dislekcia
10-05-2008, 09:15 PM
Look this is what I have got:
variabletime = 1;
if variabletime < 120 {room_speed += 10; variabletime = 0 ; }
but my only problem that it changes the room speed instantly is their something wrong with it?
Well, of course that's going to change the game speed instantly: You're essentially asking "If 1 is less than 120, do this!" that's why it happens right away...
If I were watching a clock to see if two minutes had passed, I'd remember the time that I started looking at the clock and then wait until the time it was as now was two minutes (or more) larger than the time I started at. Once that happened, I'd do whatever I needed to do and then remember the current time as my new starting time.
I wouldn't just magically go "Hey, two minutes must pass now!", I'd actually have to keep track of when I started and how much time had passed since then.
-D
Tigman_1
10-05-2008, 10:06 PM
ok great, but the problem is if I make it:
variabletime = 1;
if variabletime > 120 {room_speed += 10; variabletime = 0 ; }
then nothing happens at all, Deslekcia, Im begging you please just tell me how to do it.
Thaumaturge
10-05-2008, 11:30 PM
Are you doing anything to alter "variabletime" (aside from setting it to 1 and 0 in the above code)? If not, perhaps you should look for a way to store the time since the last alteration of the room speed in it...
Tigman_1
11-05-2008, 07:32 PM
I don't know how, can you please tell me how...
Anilihst
11-05-2008, 08:11 PM
Before you finish or try to finish this game pls look at the tutorials and search in the help file. The answers are wanting to be found.
dislekcia
11-05-2008, 08:15 PM
I don't know how, can you please tell me how...
You can change variables in all sorts of ways... Primarily you'd use maths:
a = b + c - d;
a = b / c * d;
a += b; is the same as a = a + b;
You can also combine strings using the + sign:
a = "hel" + "lo";
etc.
-D
Tigman_1
11-05-2008, 09:02 PM
so how is that ment to help me? please just give me the command instead of confusing me please:
this is what i have so far
variabletime = 1;
if variabletime > 120 {room_speed += 10; variabletime = 0 ; }
Higushi
11-05-2008, 09:38 PM
Man, we want you to learn. In order to use Game Maker effectively you need to have at least a basic understanding of variables - they form the basis of just about everything you will do. Please, get some tutorials.
Game Maker tutorials (http://gamemaker.wikicomplete.info/tutorial)
More Game Maker tutorials (http://www.yoyogames.com/make/tutorials)
and... MORE! Game Maker tutorials (http://www.freewebs.com/gmtutorials/)
Wait! Theres more! (http://www.gmtutorials.com/)
If you want to make games, you gotta learn - and it really doesn't take that much effort.
Your problem:
ok, so you've set variabletime to 1. Now what? is it just going to sit at 1 forever? You need to increment it, to do that you could place variabletime += 1 in a step event, but this will increment it to 120 way too fast since they are steps and not seconds. So, find out how many steps there are in a second (probably 30) and times that by 120. For example, if there are 30 steps in a second you would want variabletime to be at 3600 when you increment the room_speed. You should be able to figure it out from there, its just logical thinking.
dislekcia
12-05-2008, 01:09 AM
so how is that ment to help me? please just give me the command instead of confusing me please
There is no magic command you simply type in to do what you're trying to do here... You have to use logic to figure out how to string a bunch of commands and concepts together. If we just do that for you, what happens when you run into another problem that there's no simple command for? How do you think we learned how to do that? By asking other people to do it all for us?
Please, stop asking for the easy way out. If that's your approach to this, you're not going to get anywhere at all and we'd just be wasting our time... Believe it or not, everyone who has replied to you really has been trying their damndest to help you. We've all been in exactly the same place you are right now, ok?
-D
Tigman_1
12-05-2008, 06:22 PM
No the point is, I DO NOT UNDERSTAND ANYTHING OF WHAT YOU ARE SAYING, if you could just explain so well that a blind person can read it and understand, I have no problem, but anyway since you arn't going to agree with what I just said then me might aswel continue through the thick stuff...
So I have a question: by the end of this, will everything be activated through time itself or the number of steps?
eg number 1, after 3600 steps increase the room speed
eg number 2, after 120 seconds increase the room speed
So which one, Number 1 or 2?
Kensei
12-05-2008, 07:20 PM
Man, we want you to learn. In order to use Game Maker effectively you need to have at least a basic understanding of variables - they form the basis of just about everything you will do. Please, get some tutorials.
Game Maker tutorials (http://gamemaker.wikicomplete.info/tutorial)
More Game Maker tutorials (http://www.yoyogames.com/make/tutorials)
and... MORE! Game Maker tutorials (http://www.freewebs.com/gmtutorials/)
Wait! Theres more! (http://www.gmtutorials.com/)
If you want to make games, you gotta learn - and it really doesn't take that much effort.
Holy crap! Are these in the resources thread!?!? If not they should be!
@Tigman_1: I did a quick search for a timer tutorial, and found one that might help you http://gmtutorials.com/article/easy/create_a_timer/ See if that helps ;)
dislekcia
12-05-2008, 10:42 PM
No the point is, I DO NOT UNDERSTAND ANYTHING OF WHAT YOU ARE SAYING, if you could just explain so well that a blind person can read it and understand, I have no problem, but anyway since you arn't going to agree with what I just said then me might aswel continue through the thick stuff...
So I have a question: by the end of this, will everything be activated through time itself or the number of steps?
eg number 1, after 3600 steps increase the room speed
eg number 2, after 120 seconds increase the room speed
So which one, Number 1 or 2?
Then I suggest you ask more questions like "what's a variable?" instead of asking for code :) Nobody here minds trying to explain concepts like that. Do you understand what variables are for now? Why they're really useful?
You could use either tactic, both will work. If you go with the steps method, you simply need to be aware of how many steps it will take for 120 seconds to pass, which is determined by your room speed. 30 steps per second * 120 = 3600 steps. After two increases in room speed, you'll be looking at 50 steps per second * 120 = 5400 steps.
Personally I would go with the time method. Like I said before, GM tries to go as fast as you tell it to via room_speed, but it can't guarantee it. You may not be able to handle 120 steps per second on some computers, for instance.
-D
Tigman_1
13-05-2008, 05:17 PM
Dislekcia, my computer can handel 200 steps/second + so I dont mind that way, but I would like to know how to do it using the time method :)
ok, so whats a vairiable? cause im still confused :(
Tigman_1
13-05-2008, 05:49 PM
I HAZ IT!!!! YAY THANKS KENSI!!!! YAY!
Higushi
13-05-2008, 05:58 PM
This is a variable (http://en.wikipedia.org/wiki/Variable)
Its simply something that you store values in, and those values could be text or numbers, or some other things which you don't have to worry about yet. Game Maker comes with a lot of variables already set for you to use and manipulate to get the results you wish (such as room_speed).
eg.
In game maker, say now an object is traveling across the screen. It has an inherent variable called "speed" which tells it how many pixels to move across per step (or something similar to that). So if you want to change the speed at which the object is moving, you need to directly manipulate that variable. If you want to speed it up, but want it to have a maximum speed (lets say 20) that it cannot go above, you would place something like this in the event of the button used to speed it up:
speed += 1 (or you could say: speed = speed + 1)
if speed > 20
{
speed = 20;
}
we say if speed is bigger 20, then set the variable to 20. This ensures that the variable "speed" never goes above 20.
You can also define your own variables. You could make a variable called "speed_limit" and set it to 20 and use that in the place of all the number 20s in the above example. This makes it easier for you to adjust your game's settings in the future, where you would normally have to go and change all of those numbers into a new speed limit, now you only have to change the variable speed_limit.
I hope this helps :)
Tigman_1
13-05-2008, 08:30 PM
nope havnt got it :(
Anilihst
13-05-2008, 09:17 PM
I think of a variable as a box. You can put almost anything in that box. ok lets do a little example with the box.
I have two boxes in the one box I have 10 chocolate in the other box I have 5 cookies . OK so the first thing that I would do is to label each box because otherwise I won't know which box is which.
So now I call the box with the chocolates : "sweets"
And the other box I call : "Cookies".
Now I know which box is which and it does not matter if I add stuff to those boxes they will still be the same boxes but there content will be different.
So if I want to know how many chocolates there are in my sweets box I would just get my sweets box and check inside. In GML that would look like this :
show_message(sweets);
I could go on and explain further concepts but I first want to know if you understand what I am trying to tell you.
Tigman_1
13-05-2008, 09:38 PM
Ok well my mager problem is this:
I have the variables ect all worked out, but they work out something like this:
after 2minutes they increase the room speed by 10, it does this by taking the room speed multiplied by 120, which would be the same as , after X amount of steps do this....
now the problem is: after 2 minuts it activates perfectly, then after 1 and a half minuts it activates, then after 25 seconds it actives....this is causing qutie a probelo....seing that it is not activating every 120 seconds, even though the formula is room speed * 120 which SHOULD give me the amount of steps in 2minuts, but 4 some reason it aint doing that....if I could get a descent formula between the room speed/frame rate and 120 seconds that would be great
any suggestions?
Anilihst
13-05-2008, 09:49 PM
Remember the amount of steps in a second is dependant on the room speed so if you increase the room speed to 40 it means the game will do 40 steps a second which means the game will do 40*120 = 4800 steps in two min.
In view of that work out a formula to take the room speed into account.
About the real time thing; It is the same thing except now you just save the time and then check if 2 min have passed from that time.
dislekcia
13-05-2008, 09:53 PM
Ok well my mager problem is this:
I have the variables ect all worked out, but they work out something like this:
after 2minutes they increase the room speed by 10, it does this by taking the room speed multiplied by 120, which would be the same as , after X amount of steps do this....
now the problem is: after 2 minuts it activates perfectly, then after 1 and a half minuts it activates, then after 25 seconds it actives....this is causing qutie a probelo....seing that it is not activating every 120 seconds, even though the formula is room speed * 120 which SHOULD give me the amount of steps in 2minuts, but 4 some reason it aint doing that....if I could get a descent formula between the room speed/frame rate and 120 seconds that would be great
any suggestions?
Post your code please. It's usually a tiny oversight ;)
-D
Tigman_1
14-05-2008, 07:04 AM
sorted, by miself :)
dislekcia
14-05-2008, 02:34 PM
sorted, by miself :)
Nice! Good feeling, isn't it?
-D
Tigman_1
14-05-2008, 06:39 PM
yay
Powered by vBulletin® Version 4.2.4 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.