![]() |
Vecx, Vecy and move()
Alright so I'm working on a little toy and I have searched in and out of these forums for a good explanation of vecx and vecy and really haven't found something that relates to my problem. What I am trying to do is when my weapon is fired (it then joins the class) and after the npc is dropped it will move a certain distance in the direction of the player. This is what I currently have in the moving part:
PHP Code:
If anyone has some tips on using vecx and vecy for this that would be appreciated. :) |
try setting its dir on a timeout maybe.
as for vecx and vec i am clueless, never used it before. |
I wrote a very extensive article on vecx and vecy.
http://forums.graalonline.com/forums...hp?t=134263215 Anyways, what you will need to do is pass the player's direction in as a parameter/string because I don't think the player is generally in scope for dropped objects. After you do that, you can add: PHP Code:
|
isn't it player.dir == not = ?
anyway i'm interested in this as well because i've no idea how you can pass a dir to a class like that |
Quote:
What do you mean by passing it to a class? |
Quote:
relatively, you can pass a var in a weapon from the clientside to the serverside like this: PHP Code:
in java you'd just redefine the var with the classname like PHP Code:
how would you accomplish this in gs2? |
Quote:
Quote:
Class functions_bank PHP Code:
PHP Code:
When you use join(classname) on a weapon or an NPC, imagine the script of the class being copied and pasted into the weapon. You can't pass things to a class; classes extend an object. They aren't their own objects. Quote:
If you need to pass data between two objects, such as two different weapons, you can do that in a few ways: In script of -WeaponOne: PHP Code:
|
Quote:
but yeah, by 'passing vars' i literally meant re-defining one already defined anyway, OT: yes player.dir is serverside but it can't be read from/to a class (point proven i'm guessing) |
It seems you don't understand what a class really is.
|
Quote:
point proven I guess. you pretty much can't use player.dir like he was using because it won't register properly/inherit from the weapon. back 2 the drawing board still don't really understand what tig was talking about though (because I assume he was using a class to place the bomb/npc) |
Quote:
Again, classes just extend an existing object. If you can access the player object, then you can access the player's dir. |
Quote:
edit: my class was serverside whoops (//#CLIENTSIDE allows access to the player. object whereas previously it did not? anyway cool I guess it can be used serverside but first has to be read and not inherited first) |
All times are GMT +2. The time now is 03:47 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.