In my game, when the player reaches an edge, their position is moved near the opposite edge and the background is changed, but fairly consistently it "skips" a background image.
Example:
Edit: Relevant code:
AIA:
CSECarville01s01s06.aia (43.9 KB)
In my game, when the player reaches an edge, their position is moved near the opposite edge and the background is changed, but fairly consistently it "skips" a background image.
Example:
If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...
which means in your case post a screenshot of your relevant blocks...
To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
How is the logic of your background images? Is there a sequence? It might be easier to rename the images to 1.png, 2.png etc to get the next image programmatically and to avoid repetition in your blocks
Taifun
When the player hits a specific edge, depending on the background image, it will swap the background to a different image, there is no specific order.
For the board, here are the rest of the blocks ...
That can be a source of confusion.
so why are you saying
what do you expect? and what happens instead?
can you provide an example?
if we know this then we can examine the blocks
Taifun
When reaching an edge, I'd expect it to essentially move 1 image over, but what happens is it "moves" 2 over.
If the player were to hit the left edge while the background is on image 3A, the image should be changed to 2A, but instead it would "skip" 2A and become 1A. (In this case the #s are the x-coord.s and the letters the y-coord.s in a grid of 3x3, as seen in the example image)
Quick Edit: If it helps, I can try to record and upload a video.
Might be better to provide a simple example (aia project)
Here's a sample .AIA, the bug isn't actually here as far as I know, this simply simulates it.
a04245110052025test.aia (19.6 KB)
intended and unintended behaviours appear to be the same here.
Just explain again what is supposed to happen (intended) ?
Where are the background images ?
Well that's interesting, the background images, though plain, should be there (they're simply a letter in the approximate center of the canvas)
When moving from a far edge (in the example image in the original post the very left and right, or top and bottom, squares) towards the center column or row respectively, it should move 1 square in that direction. The unintended behavior is where it will move 2 squares.
Should the background images be visible, in the Unintended Behavior mode, it skips the "middle" square, labeled B. While in the Intended Behavior, it will progress through all of them (e.g. if moving purely right, you will start on A, move to B, and finally C, and reverse if moving straight left.)
I understand now. What is wrong with using your intended behaviour code ?
If you're talking about the intended behavior code in the sample project, that is an example of what I want to happen, the structure is near- (if not completely) identical to that which is inside of the actual project (the CSECarville01s01s06.aia), but the "skipping" remains, the Unintentional Behavior code is simulating the bug I experience within the primary project.
I will have a look at your full code aia project and see if there is something different happening...
My guess is that when asked to switch backgrounds, the car is somehow colliding with the opposite edge, generating another call to switch the background. You can just about see this happening if you drag the car to an edge.
I would suggest a different method/order for doing things when an edge is reached so that the car cannot collide again.
It is all a bit jumpy, you could consider "thinking outside the box" and just have a canvas larger than the screen (put it in an arrangement) with a single map (background), and move the canvas around as you move the car? This might, in the long run be more effective and easier to develop.
Pretty much right on the money, I made a list to contain every edge hit, turns out it is, for some reason, hitting the same edge twice. I'll consider the super-large canvas method, but for right now I want to try and refine my current approach. Thanks for the help!