I
InfantRegalia
Guest
Hi guys. I have this oversimplified project I use to learn Game Maker with, which is also my dream game since way back when. Here's a screenshot:
Now, let me describe it to you. It's really, really simple.
1. Everything in the game is a 48x48 square - You, the walls, the enemies, the merchants, the treasure chests, etc. - DONE.
2. You move on a grid made of 48x48 squares 1 square at a time. - DONE.
3. You move in a turn-based order. First the player takes a step, then everything else in the game room takes it's own step. - DONE like this:
In obj_enemyTurnChecker
in script scr_enemyturn
4. When you bump into the wall you say "Ouch!" DONE like this:
in obj_textboxforsayingBUMP
5. When you bump into the enemy, you take some HP from it or miss, and he takes some HP from you or misses. - "DONE" in the aformentioned scr_enemyturn
6. When you push into the direction your enemy is in, you take another swing at him, and he at you. - Don't have any idea on how to do this...
7. When you bump into a merchant, a window pops out and you get to press R for rumors, Q for quest etcetera. - Don't have any idea how to implement
So, here we are. You do see my troubles. I can't figure out half of that stuff. And the stuff I did figure out I made with 4 objects and a script, and it barely works, and I actually sometimes get LAG in the game. I know I wasn't probably born for this stuff, but I am really, really ready to learn. Can you please point me to the correct ways of doing stuff like that? Like, how can I shorten my collision coding? How do I make point 6 or 7? Which functions should I read about? I'm not asking for code, god forbid, only for proper further reading directions. I've watched a fair bit of tutorials, but none of them touch upon turn based mechanics, or how to make dialogues in game, or how to make collision without checking all sides of the square and stuff like that. Everywhere I turn to there are tutorials on platformer or zelda clone making, and nothing like my game It has to be laughingly simple, doesn't it? I mean it's basically a roguelike without all the functions and random map gen, so it has to be super simple. Why ain't I getting it?
Thanks a lot!
Now, let me describe it to you. It's really, really simple.
1. Everything in the game is a 48x48 square - You, the walls, the enemies, the merchants, the treasure chests, etc. - DONE.
2. You move on a grid made of 48x48 squares 1 square at a time. - DONE.
3. You move in a turn-based order. First the player takes a step, then everything else in the game room takes it's own step. - DONE like this:
Code:
in obj_player
global.playerturn = 1
if (global.playerturn = 1)
{
if keyboard_check_released(ord('D')) && place_free(obj_player.x+48, obj_player.y)
{obj_player.x = obj_player.x+48
global.playerturn = 0
}
if keyboard_check_released(ord('W')) && place_free(obj_player.x, obj_player.y-48)
{obj_player.y = obj_player.y-48
global.playerturn = 0
}
if keyboard_check_released(ord('A')) && place_free(obj_player.x-48, obj_player.y)
{obj_player.x = obj_player.x-48
global.playerturn = 0
}
if keyboard_check_released(ord('S')) && place_free(obj_player.x, obj_player.y+48)
{obj_player.y = obj_player.y+48
global.playerturn = 0
}
}
Code:
if (global.playerturn = 0 && instance_exists(obj_enemy))
{
global.enemyturn = 1
}
else
{
global.playerturn = 1
}
Code:
if(global.enemyturn = 1)
{
with(obj_enemy)
script_execute(scr_enemyturn)
global.enemyturn = 0
global.playerturn = 1
}
Code:
var dirr = choose(0, 48, -48)
var dirr2 = choose(0, 48, -48)
var xax = 48 || - 48 || 0
var yay = 48 || - 48 || 0
if place_meeting(x+xax, y+yay, obj_player)
{global.playerhp = global.playerhp-15}
else
if position_empty(x+dirr, y+dirr2)
{x += dirr;
y += dirr2;}
4. When you bump into the wall you say "Ouch!" DONE like this:
Code:
In obj_wall
if !place_free(obj_player.x + 48, obj_player.y) && keyboard_check_released(ord('D'))
{
global.mess = "BUMP!"}
else
if !place_free(obj_player.x - 48, obj_player.y) && keyboard_check_released(ord('A'))
{
global.mess = "BUMP!"
}
else
if !place_free(obj_player.x, obj_player.y+48) && keyboard_check_released(ord('S'))
{
global.mess = "BUMP!"
}
else
if !place_free(obj_player.x, obj_player.y-48) && keyboard_check_released(ord('W'))
{
global.mess = "BUMP!"
}
else
global.mess = ""
Code:
draw_set_colour(c_black);
draw_rectangle(0, 1200, 800, 1400, false);
draw_set_colour(c_white);
draw_rectangle(20, 1220, 780, 1380, true);
draw_set_colour(c_white);
draw_rectangle(0, 1200, 800, 1400, true);
draw_set_colour(c_white);
draw_text(view_xview[1]+400,view_yview[1]+100,global.mess)
draw_text(view_xview[1]+400,view_yview[1]+50,global.playerhp)
5. When you bump into the enemy, you take some HP from it or miss, and he takes some HP from you or misses. - "DONE" in the aformentioned scr_enemyturn
6. When you push into the direction your enemy is in, you take another swing at him, and he at you. - Don't have any idea on how to do this...
7. When you bump into a merchant, a window pops out and you get to press R for rumors, Q for quest etcetera. - Don't have any idea how to implement
So, here we are. You do see my troubles. I can't figure out half of that stuff. And the stuff I did figure out I made with 4 objects and a script, and it barely works, and I actually sometimes get LAG in the game. I know I wasn't probably born for this stuff, but I am really, really ready to learn. Can you please point me to the correct ways of doing stuff like that? Like, how can I shorten my collision coding? How do I make point 6 or 7? Which functions should I read about? I'm not asking for code, god forbid, only for proper further reading directions. I've watched a fair bit of tutorials, but none of them touch upon turn based mechanics, or how to make dialogues in game, or how to make collision without checking all sides of the square and stuff like that. Everywhere I turn to there are tutorials on platformer or zelda clone making, and nothing like my game It has to be laughingly simple, doesn't it? I mean it's basically a roguelike without all the functions and random map gen, so it has to be super simple. Why ain't I getting it?
Thanks a lot!