My kind of Boomerang...
#1
Posted 23 May 2011 - 11:53 AM
No, I'm not asking for someone to do it for me, I'm just asking the general question of ZC being able to pull off:
-A rotational boomerang path, similar to OoT.
-A "ghost" Effect of the boomerang to imitate extreme speed.
#2
Posted 23 May 2011 - 11:56 AM
#3
Posted 23 May 2011 - 02:41 PM
One thing I want to mention, though: it curves the wrong direction for being thrown with the left hand. A left-handed boomerang would actually curve to the right (clockwise).
#4
Posted 23 May 2011 - 03:28 PM
#5
Posted 23 May 2011 - 04:40 PM
#6
Posted 23 May 2011 - 05:12 PM
if timer{timer-=1;}
else{
if degreesleft{degreesleft-=7.5;direction-=7.5;}
else{
direction=point_direction(x,y,objLink.x,objLink.y);
if place_meeting(x,y,objLink) && objLink.z>=-8 && !objLink.fall{
instance_destroy();
}
}
}
NOTES
-Timer is there, because the boomerang travels in a straight line during it's count. Once it hit's 0, the boomerang performs it's 180 and returns to Link.
-degreesleft starts at 180, and is used to make the boomerang do a 180, THEN return to Link.
-It should be noted that should the Boomerang come in contact with anything that it can hit, timer should be set to 0, and most likely degreesleft too.
-point_direction is a built in function that gets the direction from one point (x1,y1) to the other point (x2,y2) in degrees (0-360).
-The Boomerang's speed was 6, meaning it travels at 6 pixels per step.
-Link's Z is used for jumping. He should only catch the boomerang if he's close to the ground. Fall is whether or not he's falling in a hole. He can't catch it if he's plummeting.
#7
Posted 23 May 2011 - 05:20 PM
#8
Posted 23 May 2011 - 05:43 PM
A fair bit in so far. I've got the skeleton laid out for what I plan to do. It may be a little messy when I finish it, but I can always go back and clean it up to make it better. :3 Though having almost all the code basically done and just adapting it into another language is obviously easier than writing it from the ground up.
#9
Posted 23 May 2011 - 07:01 PM
if timer{timer-=1;}
else{
if degreesleft{degreesleft-=7.5;direction-=7.5;}
else{
direction=point_direction(x,y,objLink.x,objLink.y);
if place_meeting(x,y,objLink) && objLink.z>=-8 && !objLink.fall{
instance_destroy();
}
}
}
Let's run it through the gmtozc convertatron 4000 and see what it says.
if(timer>0)timer--;
else{
if (degreesleft) {degreesleft-=7.5;direction-=7.5;} //define this
else{
direction=Arctan(ffc->x,ffc->y,Link->x,Link->y);
if (Distance(x,y,Link->X,Link->Y) && !Link->Jump())
is_alive=false;
}
}
}
Eh.. more or less...
Actually, now that I think about it, I'm pretty sure C-Dawg made a fairly decent boomerang script way back when. Don't know if there's still code for it though.
In Zelda Classic, the y axis is inversed, so 90 degrees is down and 270 degrees is up.
Actually GM is backwards. If you have positive y going upward then 90 degrees would be going down in GM (obviously wrong). //rant,.<>
#10
Posted 23 May 2011 - 08:45 PM
Let's run it through the gmtozc convertatron 4000 and see what it says.
LOL!
if(timer>0)timer--;
else{
if (degreesleft) {degreesleft-=7.5;direction-=7.5;} //define this
else{
direction=Arctan(ffc->x,ffc->y,Link->x,Link->y);
if (Distance(x,y,Link->X,Link->Y) && !Link->Jump())
is_alive=false;
}
}
}
I did define that:
NOTES
-Timer is there, because the boomerang travels in a straight line during it's count. Once it hit's 0, the boomerang performs it's 180 and returns to Link.
-degreesleft starts at 180, and is used to make the boomerang do a 180, THEN return to Link.
-It should be noted that should the Boomerang come in contact with anything that it can hit, timer should be set to 0, and most likely degreesleft too.
-point_direction is a built in function that gets the direction from one point (x1,y1) to the other point (x2,y2) in degrees (0-360).
-The Boomerang's speed was 6, meaning it travels at 6 pixels per step.
-Link's Z is used for jumping. He should only catch the boomerang if he's close to the ground. Fall is whether or not he's falling in a hole. He can't catch it if he's plummeting.
Of course, instead of subtraction, you'll probably have to do addition, due to the inverted directional plane.
#11
Posted 24 May 2011 - 02:24 AM
Had to nitpick ya here; ZScript for some reason doesn't support Boomerang LWeapons, I presume to be because they have a set alograthim that makes them too clunky for ZScript. The Sword, Hammer, Hookshot and Wand LWeapons also don't work when created by ZScript. Your best bet is to use a Script# LWeapon instead .
@Koh: Deifantley doable. I've haven't played far enough into ZCG yet, but I've heard that Hero of Fire implemented the same type of Boomerang you mentioned and one that curves in the Z-axis (ala SMB3) into it too. Gleeok has his code going along nicley. Also, from fiddling with scripts, 0 degrees is up and 180 is down (or so I believe).
#12
Posted 24 May 2011 - 09:00 AM
#13
Posted 24 May 2011 - 03:01 PM
float angle = 0;
float angle_counter = 0;
float boomerang_speed = 2;
float origin_x = Link->X;
float origin_y = Link->Y;
int clockwise = 1;
//this boolean to true would trow the boomerang
bool item_active;
ffc ghosted = Screen->CreateFFC();
while(true)
{
if(item_active)
{
if(!trown)
{
angle_counter = 0;
origin_x = Link->X;
origin_y = Link->Y;
if(Link->Dir == DIR_UP)
{
angle = 270;
clockwise = Choose(0,1);
}
if(Link->Dir == DIR_LEFTUP)
{
angle = 235;
clockwise = 0;
}
if(Link->Dir == DIR_RIGHTUP)
{
angle = 315;
clockwise = 1;
}
if(Link->Dir == DIR_LEFT)
{
angle = 180;
clockwise = Choose(0,1);
}
if(Link->Dir == DIR_RIGHT)
{
angle = 0;
clockwise = Choose(0,1);
}
if(Link->Dir == DIR_DOWN)
{
angle = 90;
clockwise = Choose(0,1);
}
if(Link->Dir == DIR_LEFTDOWN)
{
angle = 135;
clockwise = 1;
}
if(Link->Dir == DIR_RIGHTDOWN)
{
angle = 45;
clockwise = 0;
}
trown = true;
}
if(clockwise)
angle_counter++;
else
angle_counter--;
if(Abs(angle_counter) > 180)
{
ghosted->X += boomerang_speed * Cos(Angle(ghosted->X,ghosted->Y,Link->X,Link->Y));
ghosted->Y += boomerang_speed * -Sin(Angle(ghosted->X,ghosted->Y,Link->X,Link->Y));
if(LinkCollision(ghosted))
{
item_active = false;
trown = false;
}
}
else
{
ghosted->X += boomerang_speed * Cos(angle + angle_counter) + origin_x;
ghosted->Y += boomerang_speed * -Sin(angle + angle_counter) + origin_y;
}
}
Waitframe();
}
This code put in a global script with the lweapon copying the coordinates of the ghosted ffc would do it...
#14
Posted 24 May 2011 - 04:28 PM
..hmm. There indeed is an AngleDir8(float), but not a Dir to angle function.. If someone wants to write one I'll go ahead and add it.
edit: I just noticed that either WrapDegrees() should probably be in the range -180 - 180 also. I don't know if that will break any scripts or not.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users