Make Video Games 2018 ►
In this video we learn how to create an entire terrain generation system within Game Maker. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.
I’m the founder of codingmadesimple.com that hosts high quality, fun to learn and straight to the point course material for game developers. I’d really appreciate it if you’d check out my content.
Twitter ►
Google+ ►
Patreon ►
Have fun learning!
Nguồn: https://sam-pointer.com/
Xem thêm bài viết khác: https://sam-pointer.com/game/
Is this video outdated now? I followed the tutorial word for word and I got so many errors. Then I fixed those syntax errors and I’m still left with a few warning triangles
I did a thing in stone that, if under grass on generation, it changes to dirt
if(place_meeting(x,y-32,obj_grass))
instance_change(obj_dirt, true);
Dude you are the best person ever… I use this code in GMS2 and i works perfect 🙂 i love you man
what a clickbate lol
friends here is the code
var sh;
sh = (room_height / 2) – floor(random(room_height / 3));
sh = (sh / 32) * 32;
ah = sh;
var dirt_level;
var stone_level;
var l;
for(xx = 0; xx < room_width; xx += 32)
{
instance_create(xx, ah, obj_grass);
dirt_level = ((room_height – ah) / 32) * 32;
stone_level = ((room_height) / 32) * 32;
//dirt level
for(yy = ah; yy < dirt_level; yy += 32)
{
instance_create(xx, yy + 32, obj_dirt);
l = yy;
}
//stone level
for(yy = l; yy < stone_level; yy += 32)
{
instance_create(xx, yy + 32, obj_stone);
}
ah += choose(32, -32, 0);;
}
Looking back at this video gives me serious nostalgia, and makes me realize how much i've changed as a person. I used to religiously use gamemaker 8.1 and studio back when i was just starting out on game dev, and now i've transferred into C#/C++, This is so surreal.
thanks you are awesome
this code perform
sh = (room_height / 2) – floor(random(room_height / 3));
sh = (sh / 32) *32;
ah = sh;
var dirt_level;
var stone_level;
var l;
for(xx = 0; xx < room_width; xx +=32)
{
ah += choose (32, -32, 0);
dirt_level = ((room_height – ah) / 32) * 32;
stone_level = ((room_height) / 32) * 32;
instance_create(xx, ah, grass)
//dirt level
for(yy = ah; yy < dirt_level; yy += 32)
{
instance_create(xx, yy + 32, dirt);
l = yy;
}
//stone level
for(yy = l; yy < stone_level; yy += 32)
{
instance_create(xx, yy + 32, stone);
}
}
how can I make it like terraria physics
help me, create instance is no longer working in game maker studio 2
Well People Smashed 40likes
But you got 40 dislikes
P.S. I liked
I would not use this if i were you unless your doing something very small if your going big i would look into ds_grids.
But even that dose not help me.
So if your good at programing and you want big worlds use unity.
i whant to see more
My generation matches his without error which is weird to me
Hello.This code same but it wont create stone. No errors.
var sh = (room_height / 2) – floor(random(room_height / 3));
sh = (sh / 32) * 32;
var ah = sh;
var dirt_level;
var stone_level;
var l;
for(xx = 0; xx < room_width; xx += 32)
{
instance_create(xx, ah, object_grass);
dirt_level = ((room_height – ah) /32) * 32;
stone_level = ((room_height) /32) * 32;
//dirt level
for(yy = ah; yy < dirt_level; yy += 32)
{
instance_create(xx, yy + 32, object_dirt);
l = yy;
}
//stone_level
for(yy = l; yy < stone_level; yy += 32)
{
instance_create(xx, yy + 32, object_stone);
}
ah += choose(32, -32, 0);
}
also don't type var sh, just type sh
i thought this would be 3d
What up my dudes
Stone over grass is nattral
t is not completely random, as you see, the up and bottom sides are kind of mirrored. It is like creating straight line in random y position(assigned to grid) and generate blocks the same count up and down. 🙂
I know this might be a stupid question, but what does the "xx" mean? Like I know how x is horizontal stuff, but what does it mean when there are 2 of them next to each other?
in scrpit generate line 18 :malformed statementt :
var sh = (room_height / 2) – floor(random(room_height / 3));
sh = (sh / 32) * 32;
var ah = sh;
var dirt_level;
var stone_level;
var l;
for(xx = 0; xx < room_width; xx += 32)
{
instance_create(xx, ah, obj_grass);
dirt_level = ((room_height – ah) / 32) * 32;
stone_level = ((room_height) / 32) * 32;
//dirt level
for(yy = ah; yy < dirt_level; yy += 32);
{
instance_create(xx, yy + 32, obj_dirt);
l = yy;
}
ah += choose(32, -32, 0);
}
When I'm trying to run the script for generation then it says that there's an error, unexpected symbol at line 1 position 8 in expression… I've typed in exactly what you did~? pls help daddi i dont want to die
This is not minecraft, its terraria, we want a fully 3d minecraft, not this stuff!
i did object instead of obj lol
This is fucking Game Maker : STUDIO, not just Game Maker, why the fuck is everyone so dumb?!
Will it wotk on 1.4? cause im trying and it doesn't
_________________________________________
COMPILATION ERROR in Script: generate
Error in code at line 1:
var sh = (room_height / 2) – floor(random(room_height / 3));
^
at position 8: Unexpected symbol in expression.
is this 2D or 3D?
That Tutorial makes a LOT OF FUN =)
does any body know how he learned coding
Thankyou really much. It helped me a lot. Im new to game maker, I tried to make my own, but always failed, because I don't know all functions and how creatively and correctly use them. This is good way to learn. Well some things I don't understand well. how yy and xx works and from where you got that variables, what and how exactly every level algorithm works. I tried different ways to get rid of grass growing on stone but I couldn't!
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_generate:
Variable obj_generate.object_grass(100003, -2147483648) not set before reading it.
at gml_Script_generate (line 8) – instance_create(xx, ah, object_grass)
############################################################################################
——————————————————————————————–
stack frame is
gml_Script_generate (line 8)
called from – gml_Object_obj_generate_CreateEvent_1 (line 1) – generate();
Help!
help please whenever i load my game stone is everywhere but where grass and dirt is so my player is stuck in the same level of stone everytime!!