gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfxgfx
 
Members, please note that our guidelines are located here.
 
gfx gfx
gfx
484576 Posts in 28410 Topics by 2464 Members - Latest Member: austinrobert February 28, 2020, 02:40:47 PM
*
gfx* Home | Help | Calendar | Login | Register | gfx
gfx
The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  Layer Changing Formula
gfx
gfxgfx
 

Author Topic: Layer Changing Formula  (Read 660 times)

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Layer Changing Formula
« on: April 02, 2011, 12:59:40 PM »
I might of got the leaping formula perfected for weapons that can leap over edges. I shot an arrow over an edge and it ignored all solid masks like it should. Then when it reached a wall with a certain leap mask value, it reacted to the walls again. I took the advice of Khatuni and had it leap the second it could leap. Works so far on weapons that can move straight, not sure how it will work for my boomerang weapon.
If it does work, there will be a slight bug(not that concern yet), that if it touches a leaping mask it can't hurt enemies unless if they're up in the air.

Code: [Select]
public ChangeLayer(x,y,width,height,angle)
{
new adj[2][8] = {{0,2,0,-2,2,2,-2,-2},{-2,0,2,0,-2,2,2,-2}};
new m[8] = {40,48,24,32,72,80,56,64};

new a = AngleToDir(angle);
new Mask[3];
Mask[0] = MaskCheck(x,y,width,height,angle);

if(GetValue("this",5) == 0)
{
if(Mask[0] >= 24 && Mask[0] <= 80)
SetValue("this",5,1);
}
else
{
Mask[1] = MaskCheck(x - adj[0][a],y - adj[1][a],width,height,angle);
if(Mask[0] >= 24 && Mask[0] <= 80)
return;
if(Mask[1] == m[a])
{
SetValue("this",5,0);
return;
}
new ang[3];
ang[0] = angle/45;
ang[1] = ((angle/45) - 1)%8;
ang[2] = ((angle/45) + 1)%8;

for(new n; n < 3; n++)
{
ang[n] *= 45;
a = AngleToDir(ang[n]);
Mask[n] = MaskCheck(x - adj[0][a],y - adj[1][a],width,height,ang[n]);

if(Mask[n] == m[a])
{
SetValue("this",5,0);
return;
}
}
}
}
Could probably be shortened a bit.
Value 5 is it's current layer. All weapons start with a layer of 0 even if it's on the second floor. When it leaps it can hurt things in the air(mainly fairys), or it could go across a gap and hurt enemies on the other side.
If the wall is n,e,s,w and going the opposite way it won't bother with the loop because it doesn't need to.
Now if the entity is moving an angle other then 0,90,180,270,360 or hits a corner leap it loops to make sure it can go back to layer 0.


The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  Layer Changing Formula
 

gfxgfx
gfx
SMF 2.0.17 | SMF © 2019, Simple Machines Page created in 0.165 seconds with 21 queries.
Helios Multi © Bloc
gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!
anything