Can someone download my game? need tips
#1
Posted 30 November 2011 - 07:39 AM
Here is the download link so you can see how the game is:
http://www.2shared.c...VbLB/DEMO3.html
Walk on "WASD" punch on "left click" pick up items on "shift"
hope you can help. and if you got an idea you will probably have to help me make it (if you can) becouse I am not so good on gamemaker yet.
Hope you like it.
#2
Posted 03 December 2011 - 10:33 AM
#3
Posted 03 December 2011 - 10:45 AM
#4
Posted 03 December 2011 - 11:49 AM
If you need tips on creating your enemies movements take a look in the tutorial forums for AI movement and also using Paths and Timelines.
A path is a predefined route you plot which you can allocate to an instance to have it follow. You can create multiple paths, swapping them and even create them dynamically.
A timeline is simply a container into which you place actions which must be done at certain moments (steps).
From the manual:
Assume you want to make a guard. This guard should move 20 time steps to the left, then 10 upwards, 20 to the right, 10 downwards and then stop. To achieve this you make a time line where you start with setting a motion to the left. At moment 20 you set a motion upward, at moment 30 a motion to the right, at moment 50 a motion downwards and at moment 60 you stop the motion. Now you can assign this time line to the guard and the guard will do exactly what you planned.
For more complex AI systems (for bosses and such) you can also use grid based movements but these use some advanced functions.
#5
Posted 03 December 2011 - 12:29 PM
As for the enemies use the distance formula from algebra 1.
Put this into an enemy's step event, and the enemy will always know how far it is from the character.
Then you can do something like this in the step event.
distance = power((power(x-obj_char.x,2) + power(y-obj_char.y,2)),(1/2)); //distance formula
walkSpeed = 4; //whatever speed you want the enemy to have
if (distance < 100) //depends on how far away you want the enemy to see the character
{
//decides whether the character walks left/right or up/down first.
if (boolean)
{
if (x > obj_char.x + walkSpeed) //needs + walkSpeed because the enemy won't always land on the exact pixel that your character is on
{
// if it's less then a certain number, the enemy should stop walking and attack
if (distance < 20)
{
//put an if (not facing left) {face left;} here
//attack character
}
else
{
x -= walkSpeed;
}
}
else if (x < obj_char.x - walkSpeed)
{
// if it's less then a certain number, the enemy should stop walking and attack
if (distance < 20)
{
//put an if (not facing right) {face right;} here
//attack character
}
else
{
x += walkSpeed;
}
}
else
{
boolean = !boolean;
}
}
else
{
if (y > obj_char.y+walkSpeed)
{
// if it's less then a certain number, the enemy should stop walking and attack
if (distance < 20)
{
//put an if (not facing left) {face left;} here
//attack character
}
else
{
y -= walkSpeed;
}
}
else if (y < obj_char.y-walkSpeed)
{
// if it's less then a certain number, the enemy should stop walking and attack
if (distance < 20)
{
//put an if (not facing right) {face right;} here
//attack character
}
else
{
y += walkSpeed;
}
}
else
{
boolean = !boolean;
}
}
}Inside of the enemy's create event you'll need
boolean = floor(random(2));
Including the boolean into the code makes it so the enemy doesn't always approach from the top/bottom or left/right.
walkSpeed = 4; should probably go in the create even too. You can also get rid of walkSpeed and just replace all of the x/y +=/-= stuff with whatever movement code you prefer.
Edited by RubixCube, 03 December 2011 - 12:41 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











