Bones
|
|
« Reply #140 on: June 09, 2009, 12:28:40 AM » |
|
Oh wow, I just learned a bunch from this thread. BTW Derek, we share the same first name.
|
|
|
Logged
|
Sit down and relax, Keeping focus on your breath, This may take a while.
|
|
|
relsqui
|
|
« Reply #141 on: June 19, 2009, 01:27:33 AM » |
|
Thanks, Derek; this is exactly what I was looking for when I came here and it was very helpful. I'm looking forward to reading the next one. I adapted what I learned in these tutorials to make a very basic platformer--movement with left/right, z jump, x shoot, q quit--and a small tileset to populate it with. With any luck I'll develop it into something fun, but in the meantime, if anyone following was going to do the same thing, let me save you some trouble: http://chiliahedron.com/relsqui.gmkThe player physics are a matter of taste, of course, but there are a bunch of constants in the player creation code which you can tweak. I think they're all self-explanatory. I didn't make the sprite, although I did animate it, so permission is not mine to give to use it elsewhere. Feel free to use the tiles, though.
|
|
|
Logged
|
|
|
|
shipwreck
|
|
« Reply #142 on: August 22, 2009, 05:55:11 AM » |
|
Dereks ftw! Wow wow wow! This is some cool stuff. After dabbling a bit I finally decided to dive in. While, of course, I have pipe dreams of being an uber coder I have to crawl before I can walk and right now I'm crawling quite slowly whilst walking seems a far and distant possibility. That said, I'd like to be able to 'speak' the language of GM so I need this translated. I'm trying to wrap my head around a particular bit of code: // Revive the player if he dies if (not instance_exists(oPlayerShip)) { if (reviveTimer > 0) reviveTimer -= 1; else instance_create(view_xview[0]+32, view_yview[0]+112, oPlayerShip); } else { oPlayerShip.x += 1; } Essentially this is saying "Check to make sure the playership exists. If it doesn't then check the revivetimer. If the revivetimer (which I'm assuming is a variable in another object or just understood by GM?) is not zero then tick it down to zero. Otherwise if it is at zero, make another playership." Right? I am stuck on else { oPlayerShip.x += 1; I realize it's an "if else" statement but I can't figure out what it's saying. Is it just, 'otherwise the player ship still exists'? Halp! My brains! And great little thingy there, relsqui! Way to go above and beyond.
|
|
|
Logged
|
|
|
|
davidp
|
|
« Reply #143 on: August 22, 2009, 06:32:34 AM » |
|
if ship doesn't exist do stuff, otherwise if ship still exist, move it one pixel right
|
|
|
Logged
|
|
|
|
shipwreck
|
|
« Reply #144 on: August 22, 2009, 01:14:51 PM » |
|
That helps, thanks.
|
|
|
Logged
|
|
|
|
rrrowdy
|
|
« Reply #145 on: August 27, 2009, 01:33:44 AM » |
|
I've got a question regarding "enemy" motion that I figure is on a level appropriate for this thread (basically I'm a total newbie to Game Maker, this is the first game I've ever made).
How would one go about programming in automatic movement of an enemy based upon where a player is? For example, a zombie is triggered by the player moving closer to it.
Hmm. Eternal thanks to anybody who can help.
|
|
|
Logged
|
|
|
|
Loop Gain
|
|
« Reply #146 on: August 27, 2009, 02:04:28 PM » |
|
How would one go about programming in automatic movement of an enemy based upon where a player is? For example, a zombie is triggered by the player moving closer to it.
Off the top of my head, if you have a player object and one or more enemy objects, you could put something like this in the step event of the enemy object: player_center_x = player.x + player.sprite_width/2; player_center_y = player.y + player.sprite_height/2; enemy_center_x = x + sprite_width/2; enemy_center_y = y + sprite_width/2;
// How close the player object must be to an enemy object to activate the latter's movement. trigger_distance = 50;
distance_to_player = point_distance(player_center_x, player_center_y, enemy_center_x, enemy_center_y);
if (distance_to_player <= trigger_distance){ // Move towards the player's location. // This is very basic movement (it also assumes a top-down view), but you get the idea. if (player_center_x > enemy_center_x){ x += 1; } else if (player_center_x < enemy_center_x){ x -= 1; }
if (player_center_y > enemy_center_y){ y += 1; } else if (player_center_y < enemy_center_y){ y -= 1; } }
Hope that helps!
|
|
|
Logged
|
|
|
|
rrrowdy
|
|
« Reply #147 on: August 27, 2009, 03:00:36 PM » |
|
How would one go about programming in automatic movement of an enemy based upon where a player is? For example, a zombie is triggered by the player moving closer to it.
Off the top of my head, if you have a player object and one or more enemy objects, you could put something like this in the step event of the enemy object: player_center_x = player.x + player.sprite_width/2; player_center_y = player.y + player.sprite_height/2; enemy_center_x = x + sprite_width/2; enemy_center_y = y + sprite_width/2;
// How close the player object must be to an enemy object to activate the latter's movement. trigger_distance = 50;
distance_to_player = point_distance(player_center_x, player_center_y, enemy_center_x, enemy_center_y);
if (distance_to_player <= trigger_distance){ // Move towards the player's location. // This is very basic movement (it also assumes a top-down view), but you get the idea. if (player_center_x > enemy_center_x){ x += 1; } else if (player_center_x < enemy_center_x){ x -= 1; }
if (player_center_y > enemy_center_y){ y += 1; } else if (player_center_y < enemy_center_y){ y -= 1; } }
Hope that helps! That helps SO MUCH you have no idea. I'll love you forever. I'm getting a Loop Gain tattoo as I type this.
|
|
|
Logged
|
|
|
|
nylos
Level 0
|
|
« Reply #148 on: September 17, 2009, 11:28:41 AM » |
|
Awesome work Derek :D. Are there any turtorials like this for other things like rpgs or jump 'n' runs?
|
|
|
Logged
|
|
|
|
Destral
|
|
« Reply #149 on: September 19, 2009, 02:48:27 PM » |
|
Thanks Derek for the tutorials, and everyone else who's been helping out with questions. Definitely a great help learning GML. I've been doing some GM tutorials using the drag and drops, but figured I really should learn GML as well. I'll post some screenies and such of my progress sometime this weekend.
|
|
|
Logged
|
|
|
|
givecake
|
|
« Reply #150 on: April 25, 2010, 09:47:14 PM » |
|
Hello all. I was following this tut today, and got stuck on creating walls. I'm using the newest version of game maker, 8.0 and when I place the oWall object on the map, I get a little blue circle and red question mark, like the oGame object. Is there an attribute in the oWall settings that must be added somehow? I've followed the tutorial exactly, as far as I can see, and the only things I've changed with oWall, was the name and uncheck 'Visible' to make it invisible (although it never had a sprite, so it would be invisible anyways :O ). Thanks for any help Robin
|
|
|
Logged
|
|
|
|
Ted
|
|
« Reply #151 on: April 26, 2010, 12:04:48 AM » |
|
If an object doesn't have a sprite assigned to it then it will use that blue circle with the red question mark (which will not be visible when the game runs). If you open the oWall object you can change its sprite by clicking where it says <no sprite> and selecting a new one.
|
|
|
Logged
|
|
|
|
givecake
|
|
« Reply #152 on: April 26, 2010, 02:10:14 AM » |
|
Thanks Got it sorted!
|
|
|
Logged
|
|
|
|
antymattar
|
|
« Reply #153 on: September 29, 2010, 09:16:47 AM » |
|
|
|
|
Logged
|
|
|
|
imaginationac
|
|
« Reply #154 on: September 29, 2010, 12:09:18 PM » |
|
That would be awesome, but there's an actual picture of himself in the first post of the Obligatory Introduce Yourself thread.
|
|
|
Logged
|
|
|
|
smokingspoon
|
|
« Reply #155 on: October 15, 2010, 03:20:25 PM » |
|
Those tutorial are incredible... The best I've seen. Thank you very much mister Derek Yu, you gave me hope after all those years haha
|
|
« Last Edit: October 15, 2010, 04:02:04 PM by smokingspoon »
|
Logged
|
|
|
|
antymattar
|
|
« Reply #156 on: October 27, 2010, 02:52:49 AM » |
|
I ma making a game from this. Can I use and edit the tileset? I am going to give you credit.
|
|
|
Logged
|
|
|
|
tatthi
Level 0
I Feel Fantastic
|
|
« Reply #157 on: December 22, 2010, 09:30:51 AM » |
|
Hey I can't find the views in Game Maker 8. Anyone want to help me?
|
|
|
Logged
|
|
|
|
GZ
|
|
« Reply #158 on: December 22, 2010, 12:43:14 PM » |
|
Hey I can't find the views in Game Maker 8. Anyone want to help me? File>Advanced Mode Make sure it's on, otherwise many things are hidden.
|
|
|
Logged
|
|
|
|
tatthi
Level 0
I Feel Fantastic
|
|
« Reply #159 on: December 23, 2010, 07:19:36 AM » |
|
Well now I feel stooped. Seems like it switches itself off whenever you close the application. Thanks!
|
|
|
Logged
|
|
|
|
|