Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: A few GM Questions  (Read 816 times)

0 Members and 1 Guest are viewing this topic.
A few GM Questions
« on: October 08, 2006, 08:00:15 pm »
  • Elbows deep within the borderline.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 324
These may be hard to understand, soo bare with me...:

1. How do you make it to where when you want Link to attack, he will attack in the direction your standing. Cause when I did it, everytime I pushed the attack button...he goes back forward and attacks. Hoe do you make it where you can attack in the direction your standing is what I'm trying to say.

2. How do you make it to where you have to be standing next to something to talk/ use/ or press it. Like for example, I want to walk up and talk to someone, So I have to get next to them to talk to them. But All I can make it do is when I push a botton, no matter where I am in the room, I can still tlak to the person.

I hope these make sense, but if they don't, I'm sorry.

Thanks in Advance,

W2link1

4Sword Edit: Do not triple post.  If no one is helping you, it is because they are busy and have lives too; that however does not mean that they will not help you, it means that they have not gotten around to it.  This is a warning; learn some patience.
« Last Edit: October 08, 2006, 09:24:37 pm by 4Sword »
Logged
And the world rolls on...
Re: A few GM Questions
« Reply #1 on: October 08, 2006, 10:27:24 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
1. Keep a variable storing the direction you're moving in. For example, global.direction or global.facing. Then, check which way you're facing, and change the sprite accordingly. You base the direction on which way you're moving - for example, if you are holding the right arow key, you are facing to the right. There are a bit more complications, such as diagonal movement or multiple button presses, but they aren't hard to figure out - you can do it.
2. You again check which directino you're facing. You then check if an instance is at a position using instance_position. Then, if it is a certain object, you "talk" to them. This could mean calling a textbox script or doing whater.
Logged
Re: A few GM Questions
« Reply #2 on: October 09, 2006, 04:38:05 am »
  • Am i here or am i not?...
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 238
2.make a code with somethinglike;
Code: [Select]
{if distance_to_object(obj_player) <= 20 then show_message("hello!")

If you have pressed key X fore example...
Logged

Jed

Re: A few GM Questions
« Reply #3 on: October 09, 2006, 05:19:43 am »
1) Yes global.facing - direction refers to the objects direction of travel and isn't suited to this case. Do a switch or if... then check with the attack, display the animation and perform the checks, damage, etc depending on the return value.

2) Again use facing.

obj_chest:
~space bar down
switch global.facing
{
case "left": if (instance_place(x+32,y,obj_player)) { open the chest }; break;
case "right": if (instance_place(x-32,y,obj_player)) { chests on the left now :O; break;
}


Edit: Oops, forgot the case keywords :x
I havn't used instance_place much so that syntax maybe wrong but that SHOULD work. Change the curly bracketed stuff to suit, add the other directions, etc and its done.
« Last Edit: October 09, 2006, 05:28:06 am by Jed »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.098 seconds with 45 queries.