Posted: 31st Jan 2021 20:19
Hello all,

I am well on my way with an RPG/RTS with graphics similar to JRPGs, and I'm wondering how I should deal with drawing items/characters that are behind other objects (like a tree). For example, it's possible to drop a sword behind a tree and completely not be able to see it. You can still click on it and pick it up, but I need some way to show the player that it's there. Is there an easy way to draw the outline of a sprite or something?

(Before I waste time doing something else. Thanks.)
Posted: 31st Jan 2021 20:23
Is SetSpriteDepth() what you are looking for?
Posted: 31st Jan 2021 20:43
Reading from the manual:
"...For maximum performance it is recommended that every sprite has its own depth value unless the order they are drawn is not important, for example physics sprites that won't normally overlap...."
I suggest you, to make a plan on the creation order of the sprites without using the command 'SetSpriteDepth()' within the main game loop
Posted: 31st Jan 2021 21:04
It's not about sprite depth. This question is more about how I represent a sprite drawn behind another sprite so the player knows it's there. Tis more of a philosophical question, but also I don't wanna overlook some easy command and waste a bunch of time.
Posted: 31st Jan 2021 21:05
I need to be able to draw an outline of a sprite or something.
Posted: 31st Jan 2021 21:12
Well, you're still going to have to deal with depth. Something like this:

peudo code...obviously
+ Code Snippet
If GetSpriteDepth(Sword.Sprite) > GetSpriteDepth(Tree.Sprite)
    SetSpritePosition(SwordOutline.Sprite, GetSpriteX(Sword.Sprite), GetSpriteY(Sword.Sprite))
    SetSpriteDepth(SwordOutline.Sprite, GetSpriteDepth(Tree.Sprite) -1 )
Endif


Or another way could be to actually put it over the tree, but bring down it's alpha value...

+ Code Snippet
If GetSpriteDepth(Sword.Sprite) > GetSpriteDepth(Tree.Sprite)
     SetSpriteDepth(Sword.Sprite, GetSpriteDepth(Tree.Sprite) -1 )
     SetSpriteColor(Sword.Sprite, 255,255,255,50)
Endif
Posted: 31st Jan 2021 21:18
Is there any easy way to check if a sprite is completely hidden behind another sprite?
Because what I'm thinking is I will make a little glimmer thing occasionally so the player will know something is there.
Posted: 31st Jan 2021 21:19
Mod Edit, I wanna just give out my code but I'm too paranoid. I've already done that. Thanks for helping, though.
Posted: 31st Jan 2021 21:21
I'm thinking now that all obtainable items will occasionally glitter. It's probably the only solution.
Posted: 31st Jan 2021 21:39
ideas?
yeah. watch your language and don't triple post or otherwise spam, as above.

otherwise,
...represent a sprite drawn behind another
consider this discussion.

@n00bstar, please add the lang=agk part when Posting Code (see my sig and the Syntax Highlighting requirement).
Posted: 31st Jan 2021 23:23
"


HAHAHAHHAHAHHAHAHHAHAHHAHAHAHHAHHA

Seriously... syntax highlighting *REQUIREMENT* when posting a peudocode block. You people need to calm down. [MOD EDIT] Your "pseudocode" is in fact AppGameKit code and it is therefore a requirement as per the "Rules and Guidelines" of the "AUP" here

Don't know what's up with you this weekend, editing people's posts and acting like you're judge Dredd or something.. But you need to reevaluate your life buddy.

Read it under my avatar. 16 years of support for this stupid company. An now you've just lost another member of this community. See if that helps you or the product in the long run.
Posted: 1st Feb 2021 0:06
Thanks for unblocking this. No more profanity.
Posted: 1st Feb 2021 18:22
these are solid sprites part transparent part not. Two images stacked. You can make a Third sprite with elements of both or using an alpha. Or u can use draw image sprite draw second image hidden sprite create sprite main sprite. There's prolly 5 different ways to do it inside agk plus a shader method.
Posted: 1st Feb 2021 20:49
Yeah, it's just gonna look weird to have the entire sprite transparent (or differently shaded). An outline of the sprite would look best, but I think that's too difficult. I'm going for an occasional glittery sparkle, I think. ("glimmer", "glint", "gleam", some kind of G word)
Posted: 1st Feb 2021 21:27
Do you think it might be possible to post the two sprites? or at least two sprites similar to the ones you're using
Posted: 1st Feb 2021 23:18
Why not use particles?
Posted: 2nd Feb 2021 0:43
I'll put up Demo v7 on itch.io in about 5 days or so and post it here so you can see. But I'm gonna use this quick sprite to let the player know there's an item hiding behind the tree/wall/etc.

Posted: 2nd Feb 2021 2:30
Is this what your looking for?
Posted: 2nd Feb 2021 4:48
if you have Studio, maybe play with:
+ Code Snippet
SetSpriteTransparency(Wall,3)
SetSpriteBlendModes( Wall, 10,3 )

(insert within Blink's code above)
Posted: 2nd Feb 2021 4:52
I have classic but I'll check both of these out tomorrow.