How to duplicate or create an image sprite at runtime when coordinates change

77 views
Skip to first unread message

Girik Jindal

unread,
Oct 3, 2018, 6:06:22 AM10/3/18
to MIT App Inventor Forum

Thank You for your early response.
Actually that is not my problem. I have attached a video which shows exactly what I want. In this, if we select the card and click anywhere on the battlefield, an image will appear in the battlefield and the card will be replaced by another. I tried doing this in MIT App Inventor but it didn't work.
I can't hide the image sprites as if I do so, I'll require over 200 images sprites.
       
    with reference to the response by SteveJG
         On Tue, Oct 2, 2018, 6:49 PM 
SteveJG <steve....@gmail.com> wrote:

    These two tutorials should help
    You cannot create an Image Sprite with App Inventor (run time); all the sprites have to be created when the app is designed (design time).  A user can 'hide' unused sprites by      setting their Visible property to false and show them again when need by setting the property to true.

    You can monitor the coordinates of a specific sprite if you need to "duplicate an image at runtime when coordinates are changed" if you need to do it using If statements..
    I think you just want to replace a sprite when it is tapped with another sprite ... possibly a different card face?

    There are examples of card games in the MIT Gallery.   You can search for  perhaps   Blackjack  or   card game ; one of the examples aia files probably shows how to do what you want to do Girik.

    Did any of this help you figure out what you need to do?

    Regards,
    Steve
Clash Royale replay.mp4

Chris Ward

unread,
Oct 3, 2018, 8:04:35 AM10/3/18
to MIT App Inventor Forum
Hello Girik

The problem is that you seem to want a 100% all-problems-solved-answer from us without any effort to code from your side.

We are a small team of volunteers with thousands of other people to help too!

The total number of sprites required is largely determined by the number of unique sprite images required, unless there is a reason for duplicates to be on screen at the same time. It's pretty obvious that you can't display 200 sprites on the average phone screen all at the same time, each with their own ordinates -so that sounds like you think something is necessary when it is not - perhaps you think a hidden sprite must be at a predetermined position? Not at all.

The art of programming a more complicated App is to code-up individual parts of it as individual mini Projects and test those to prove your idea.

Here is an example. Let's make a Test to see if:

1)We can store Hidden Sprites in the same location (Say, X1, Y1)
2) When the Sprites are Unhidden, they can be individually displayed @ specific locations elsewhere on the Canvas

BlocksTestHideShowSprites.png



GUI_In_Action.png



...........So now we know from this experiment -we can do this!








Ghica

unread,
Oct 3, 2018, 8:07:27 AM10/3/18
to MIT App Inventor Forum
Is this a continuation from another thread? Why do you start a new o
Why would you need 20 image sprites?
You just need as many as can appear at the same time on your screen: 10, 20, 40 maybe, but 200, I do not believe it.
You can reuse sprites, put other figures on it and so on.

b.t.w. Personally I do not like to go look at video's. Post your blocks, show us what you tried.

Chris Ward

unread,
Oct 3, 2018, 4:25:15 PM10/3/18
to MIT App Inventor Forum
This is the response I received from Girik, direct to my email:

I think I have tried enough and them I am forced to ask a doubt on this platform with jerks like you. We can't just look at what is possible and what is not. everyone knows that we can hide image sprites and use ten at same coordinates. That is what I have currently done and I was told the same by SteveJG and Taifun. So I believe you have done no good with your response. Also you think it is a good option to have a game with 200 image sprites (This was just an example ... actually we will require much more) then a heavy setup for having a realtime server then guild plus friend list online check then random search for online variable and many more things. and you think my game will work after all this. If I am asking a way to reduce the size and make my game work, you are saying that I want a solution without an effort to code. This shows how well you analyze a doubt. I have been working on this application for months and you say that there is no effort. I guess this platform though has just a small team of volunteers but it doesn't need people like you who instead of helping make fun of their effort. I am making a pretty hood effort much more then you Chris. Thank You for your so called support.

Girik is raising different posts on the same subject, so we do not know what response has already been made.

In my view, the time I spent making an example mini-app (see above) was good support. In my view, people like Girik who choose to be rude should not be getting our support.
Reply all
Reply to author
Forward
0 new messages