[Zscript] DrawTexture question
Posted: Wed Sep 20, 2017 9:47 pm
Hello! I try to make when you look at specific actors (can more five actors on screen) -> draw images on screen.
I try use RenderOverlay but i doesn't know how to access to actors positions.
It's possible convert object scopes from play to ui ?
Current code:
I try use RenderOverlay but i doesn't know how to access to actors positions.
It's possible convert object scopes from play to ui ?
Current code:
Code: Select all
Class TestDrawerClass : Actor
{
TextureId tex;
Default
{
Health 0x7FFFFFFF;
Mass 0x7FFFFFFF;
Renderstyle "Add";
Scale 1.25;
radius 32;
height 32;
}
override void BeginPlay()
{
tex = TexMan.CheckForTexture("ALERT", TexMan.Type_Any);
super.BeginPlay();
}
void DrawOnScreen()
{
//Taken from HudMessageOnActor, broken
double x,y,vang,angle,dist;
Vector2 selfPos = (self.pos.x,self.pos.y);
Vector2 playerPos = (players[0].mo.pos.x,players[0].mo.pos.y);
x = selfPos.x - playerPos.x;
y = selfPos.y - playerPos.y;
vang = atan2(x,y);
angle = (vang - players[0].mo.angle + 1.0) % 1.0;
if(((vang+0.125)%0.5) > 0.25) dist = y * sin(vang);
else dist = x * cos(vang);
if ((angle < 0.23 || angle < 0.85) && dist < 2048)
{
if (players[0].mo.pitch >= -0.5 && players[0].mo.pitch <= 0.5)
{
Screen.DrawTexture(tex,false,x,y); //Error
}
}
}
override void Tick()
{
Super.Tick();
if(!master)
{ Destroy(); }
if (master)
{
DrawOnScreen();
if(radius != master.radius || height != master.height)
{ A_SetSize(master.radius+2, master.height/8); }
A_Warp(AAPTR_MASTER,1,0,master.height - self.height,0,WARPF_INTERPOLATE|WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION);
}
}
States
{
Spawn:
TNT1 A 1;
loop;
Death:
TNT1 A 1;
stop;
}
}