How do I display my object sprite on another object without actually placing it?

Hello, I’m working on my game project but I’m facing some problems one of them is a problem about
rendering object sprite into a card

The cards will randomly generate items and now it can’t display its random item image.
I already have my objects with sprites, but I’m not sure how to display them appropriately

I’m thinking of 2 possible solutions but I want another solution to do this rather than:

My first solution: Using animation, When a card rolls the object name set the animation name according to what object it gets but the problem is I need to create too many animation when I already have my sprites and in my game there will be more than 100+ sprite so it’s a waste of time and game size / memory isn’t it?

My second solution: Just create the actual object then put it on the card at some point X,Y I have tried it and… it worked but…. I don’t think I should do this way because it may ruin my game logic where I have to count object instance or something like that.

What I want to know is are there any way to render the object sprite without actually creating it and how?

Ok, just make separate objects with the same sprites(or, just one with separate animations) and use your second fix, creating the objects, that way it can’t interfere with the logic

1 Like

Hi, thanks for your answer I guess I’ll use my second choice with your advise.

On top what Inusitatus wrote
I am making Minicraft clone (not minEcraft clone) which is in fact pre minEcraft version made by same person

And i was wondering how i will handle having for example wood sword drop on ground and it being a pickup item and not weapon
So when enemies walk over it they do not get hit by it
Same if i would drop wood pickaxe on ground (throw it away) and it land on stone then it should not damage stone
So i do need it as separate item

And so far my best idea was to
Have wood sword object which would be a weapon that my player use
While for all pickup items which drop on the ground when enemy is deleted
Or when it drop from chest
I would create object called PickupItems and simply add each item to it as separate animation
And i simply just make dropped item pop from something and change it animation to wood sword or iron sword or gold pickaxe or torch or whatever
While in addition to this i would
In addition to that i would need to duplicate this object (PickupItems) and rename it to UIItems
So when i open inventory and every single item displayed there displayed there do not interact with with anything beneath menu window like terrain or enemies or even player

So if i open menu i see there wood shovel it do not automatically dig hole in the ground

And that is my best idea so far
Maybe there is better way but i was unable to find any

1 Like

@ZeroX4 Thanks for sharing your story, I think I would do the same create a new drop object then select its animation by name. For me I think it’s the best thing I can do now without having to code.

I mean it is best solution if you have multiple objects
And you do not want to duplicate each of them 2 times in your object list
So you end up with idk 50 objects and you duplicate each 2 times and now you have 150 objects in your list which are just items

My method would be 50 objects + 2 more with all animations of same objects

MAYBE i could have only 3 objects and simply change animation for each of them
IDK how that would work
Maybe too much configuration but for sure possible

1 Like