Image Sprite Speed Bug?

So What I'm trying to do is make a sort of game like the new modern ones coming out already, where your character 'moves' around on the screen, dodges monsters, and endlessly upgrades their weapons and other things. Problem is, I can't even come up with a most basic prototype. First Problem: I have the monster sprite and attack sprite set to the same interval and speed, but the attack sprite is moving about 20 times faster than it should, basically teleporting to the monster sprite. Anyone have any ideas? The only thing i can think of is their different sizes, but that shouldn't make this big of a disrepancy if the monster is 32 pixels and the attack is 16 (square) I've tried AI, myself, and nothing is working. So maybe you guys can help? And if anyone has ideas for any other things I can implement for the other elements for this type of game, It would also be appreciated!



What is your rotation switch setting on your Sprites?

Are you using Heading to set rotation angle of the image, or are you use Heading to control movement direction?

Is it possible you are getting Sprite self-movement in addition to X,Y readjustment in your Timer?

Also, fine print on Speed and Interval:

Interval

The interval in milliseconds at which the ImageSprite’s position is updated. For example, if the Interval is 50 and the Speed is 10, then the ImageSprite will move 10 pixels every 50 milliseconds.

Speed

The speed at which the ImageSprite moves. The ImageSprite moves this many pixels every Interval milliseconds if Enabled is true.

P.P.S. What are your Clock Timer milliseconds settings?

So I'm currently using no rotation on the sprites, just having them move in the specified direction without changing the picture from its upright position. I'm using the heading, interval, and speed properties to set the angle, and speed that they would initially be going to, and the dragged is to add movement onto that to simulate movement when the screen is dragged by just adjusting its position (in the inverse direction of the drag). And half the problem that I don't get is that the same speed and interval setting for the attack sprite and monster sprite are seemingly working differently. The monster sprite moves at a respectable speed, but the attack sprite moves unreasonably fast. My clock settings are movement goes off every 10 milliseconds, attack every 1 second. Thank you for responding so fast!

10 milliseconds is not much time for a Clock Timer to do its work in Ai2.

Try 100 milliseconds instead.

P.S. You did not show global Monster_speed.

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
export_and_upload_aia

Sprite movement ... perhaps there are some ideas in this post
I’m making a 2D platformer (How do you make a Ball or Sprite 'jump'?) - #24 by SteveJG you can use.

You get smooth movement using techniques as shown.

Okay, setting the movement timer to 100 really helped a lot, and now the attack sprite moves at a normal speed. But now 2 more problems came up. First: The image sprite will now teleport to the monster when the screen is dragged. Second: I can't move the monster sprite effectively with the added movement now. I tried setting their intervals to 100 as well, but i cant manage to do anything to make it move away from the character sprite, or any other direction, even if I increase the maximum speed. If you guys are willing to find out what is going on with that, I would be grateful.

P.S. The monster speed is 2, just like the attack sprite. Sorry if I forgot that. I also have not implemented an attack and monster sprite collision sequence yet, as I am trying to just get the basic things to work for the moment, so feel free to make your own or work without it.
SWARM.aia (11.3 KB)

Here is my animation collection.

For your project, I would try separating the dragging entirely from the sprite movement.

I used a list of draggable sprites, and a loop over them in the drag event.
I also removed drag movement from everywhere else.

SWARM.aia (11.3 KB)




I did not test this.

I do feel like doing this will help a lot, if only for organization, plus the attack sprite no longer teleports, but the one reason that I didn't implement this before is because the dragged event only registers when the screen is being actively dragged, and not when it is being held. Also, the monster sprite is still undeterrable no matter what speed I set for the character or monster sprite.

P.S. For future reference, the character sprite should not move from the middle of the screen. It will stay in place while the background and other sprites change to give it a feel of movement while allowing the character sprite to stay easily visible in the center, as well as preventing monsters spawning and attacking the character immediately.

I have reached the limit of my experience on animation techniques, so I leave it to you to blaze the trail on this.

Look in the Canvas FAQ for the defunct Scott Ferguson Developers Library, where he posted advanced graphics projects.

There is also the AI2 Gallery's search facility.

Thank you for trying your best! I will keep trying to work out a solution and will post it here if I do. Thank you sincerely for your help!

And now is the point where I admit that I am just as fallible as any human being. The attack sprite was teleporting because I set it to move to the monster sprite's coordinates, and the monster sprite itself wasn't moving becuase the movement timer goes off every 100 milliseconds, instead of the monster's 10, so I needed to set the movement to 10 times more for it to work. I don't know how to respond for wasting people's time, except that I hope people learn from this and (I can't resist free advertising in case I do manage to make this) I will eventually post my game's finalized name on my profile and everyone can use the code Revise9735 to repay their time on here, and another code to ABG especially should you want it. Once again, I am so sorry, and I hope that all will be forgiven. Thank you all!

Thanks for letting us know the cause of the problem.

It helps us sharpen our debugging skills.

One of the other PUs encourages people to set their attributes in blocks at run time instead of the Designer.

It would have made the bug easier to spot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.