I seem to be having some problems with sprites at the moment
on 3.0 and 3.1 when I change a sprite using type and frame it displays the wrong one whereas spawn is ok (I do this so I can keep the same amount of sprites on screen because when I use spawn I can lose some enemies ie they don't spawn), also I decided to add some frames of animation to an existing sprite and when I animated it it changed to a completely different sprite rather than changing the frames
the game was started in 3.0 so the problem may be from the original compile, I'm going to rewrite it fresh in the 3.2 demo to see if the problem continues
I'll report any findings properly in the bugs section
Post by Jonathan Cauldwell on Jun 23, 2012 18:03:58 GMT
When you changed the sprite IMAGE, did you remember to set the sprite FRAME to 0 at the same time? That might cause the problem you're seeing.
Say your first sprite has 8 frames, and your second sprite only 4, then changing the IMAGE while the FRAME is between 4 and 7 will mean your FRAME is beyond the range for the new sprite. That would result in frames from the next sprite being displayed.
Jonathan, unfortunately an old ugly problem still persists: when I try to clear all the resources and resize the window area, I often keep getting artifacts which reset the AGD because I cannot delete screens properly. Perhaps a safe option to reset resources would do.
Also I was able in your FK-like example to drop items into a wall, any remedy? Not really a problem, but when pressed both left and right then it pretends walking)
By the way in the option screens I often miss active keys hint
[slightlyofftopic]Jonathan, how have you come to the conclusion that 12 pre-shifted sprites are enough? For example, I often run into situations when I need animated, but not moving sprites; is it the same case?[/slightlyofftopic]
Post by Jonathan Cauldwell on Jul 4, 2012 16:44:37 GMT
Sorry, I've been unable to recreate the problem resizing the window. The only way forward would be for you to send me a snapshot that goes wrong when the window is resized So I can recreate it. Realistically, I'm not going to get a chance to look at it for a couple of months either.
When dropping items you could use CANGOLEFT or CANGORIGHT to check there are at least a couple of pixels left or right.
To stop walking left and right simultaneously just use a variable to determine when neither, one or two is pressed. Start at zero, add 1 for left, 2 for right and only animate at the end if your variable comes to 1 or two at the end. There are probably many other ways around it, but that's one way I can think of very quickly.
I'm not sure I understand your point about sprite limits. What limit is this?
There's no need to resize the window because it just more sure way which makes glitchy blinking somehow undeleted screens reset the AGD. Just load the AGD 3.2 snapshot and try deleting screens, recheck and viola! Beatlemania... So I still think that adding some 'NEW' option to clear everything safely would nicely do, perhaps per tab.
Also as far as there're only 12 maximum sprites on the screen, may be it makes sense to have a handy addressing option, e.g. sprite.x=5 or sprite0 other. For example, it could simplify sprites interaction and made it simpler to, say, check the distance. On the other hand, just distance 0 2 function would do.
Yes, you write that there're only 12 sprites can be simultaneously shown on the screen without any issues, but why exactly 12? not 8 or 16? Because of pre-shifting? If so, then it's often the case that I don't need all sprites to be preshifted, because many of them although a little animated, but still. Would it be any different? (craving for animated objects then)
Post by Jonathan Cauldwell on Sept 3, 2012 17:30:06 GMT
I'll take a look at the problem deleting screens when Encyclopaedia Galactica is finished, at the end of this month.
As for addressing sprites with SPRITE0 OTHER or similar, I'm not sure a function like that will be of much use. Sprites are re-ordered as they move around, so SPRITE0 may refer to the player one frame, and an enemy the next.
The limit is 12 sprites as that's the limit of what AGD can draw at 25 frames per second. You may not realise it, but that's not bad going for a Spectrum! Adding more would cause the frame rate to drop to 16.66' FPS. Most of AGD's time is spent deleting and redrawing sprites, they can move around and be animated, so they have to be maintained. Moving them around the screen (ie simply changing a sprite's x and y coordinates) and animating takes a few clock cycles, but deleting and redisplaying them is very time-consuming. Objects, on the other hand, are static. They are drawn when the screen is refreshed and don't have to be updated, so you can have as many of those as you like.
Hello Jonathan--I understand that you're still busy, yet could you please post a 'clean' version of AGD 3.2 (without screens, sprites, events, etc), because I tried a few emulators with a similar result: after moving/resizing the view window I get aforementioned numerous garbled screens which eventually reset AGD...
Post by Jonathan Cauldwell on Nov 10, 2012 12:56:04 GMT
I'm not yet sure what the problem was with the earlier snapshot, although the game data may have been corrupt in some way which may have led to the screens not being removed properly. Anyway, here's a version 3.2 blank canvas snapshot: