Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Help] - Skywyre Edition v10 - Shadow


AngelR
 Share

Recommended Posts

Hi friends, I have a question, how to activate the shadows of npc and player ?.

The engine has to put it, but I do not know which part of the code can activate it.

![alt text](https://i.imgur.com/y92GE66.png)

Thank you for those who can help me.
Link to comment
Share on other sites

@xlithan Thank you very much, they were with you and I changed the coordinates.

' render player shadow
If hasShadow(Sprite) Then RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255, 150)
RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255, 150)

' render player shadow
If hasShadow(Sprite) Then RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255, 150)
RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255, 200).

But for large npc sprites it does not work.![alt text](https://i.imgur.com/SrLyohH.png)
Link to comment
Share on other sites

@angelr said in [\[Help\] \- Skywyre Edition v10 \- Shadow](/post/700353):
> RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255, 150)

One way to draw shadow everytime is to remove the

'If hasShadow(Sprite) Then

Other way is to scale shadow image by sprite image. I made a quick code that should work.
It is based on Sprites width (Because shadow is 32x32 + adding height to calculation would over complicate things)
This simply draws shadow based on sprites width. If its bigger than the shadow width then the shadow gets resized to the size of Sprites width x Sprites width. This way quality loss will be minimal. Anyway here is the code:

Dim shadowTempX as long

If VXFRAME = False Then
shadowTempX = Tex_Character(Sprite).Width / 4
Else
shadowTempX = Tex_Character(Sprite).Width / 3
End If

If shadowTempX > Tex_Shadow.Width Then
RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, shadowTempX, shadowTempX, shadowTempX,shadowTempX, D3DColorRGBA(255, 255, 255, 150)
else
RenderTexture Tex_Shadow, ConvertMapX(X), ConvertMapY(Y + 18), 0, 0, 32, 32, 32, 32, D3DColorRGBA(255, 255, 255,150)
End IF

Hope this helps :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...