|
Post by BiNMaN on May 29, 2015 18:32:52 GMT
I've used this a condition in previous versions (using 4.6 at the moment) so I could have code that would only be executed in a sprite type with a certain image.
For example I spawn a type 2 with an animation to when it spawns but it is static (think concentric circles growing from a set point), once parama reaches 100 it turns into another image (enemy sprite) and starts to move.
IF IMAGE 2 ANIMATE ADD 1 TO PARAMA IF PARAMA > 100 LET IMAGE = 4 ENDIF IF IMAGE 4 DO THIS CHUNK OF CODE AND MOVE ABOUT ENDIF
It's definitely worked in previous versions, I'm rewriting a game I started in 3.2 and I've used it in that version.
On a side note the game has a 8 directional control (9 and 0 rotate, 2 thrust, w fire), the frame number is dictated by DIRECTION (which is increased, decreased by using 9 and 0 keys) and in the 3.2 version when fire is pressed I use the variable b to hold the value of DIRECTION
IF KEY 2 LET B = DIRECTION SPAWN 1 1 BEEP 25 ENDIF
which I use to pass from PLAYER CONTROL through to SPRITE TYPE 1 so the bullet knows which way to go and then in INITIALISE SPRITE I use
IF TYPE 1 LET DIRECTION = B ENDIF
However in 4.6 I haven't passed the information through, the bullets I spawn know what direction to travel without me passing through any conditions when I spawn them.
|
|
|
Post by andrewvanbeck on May 29, 2015 19:05:09 GMT
I haven't had these exact issues, but if I test the game, then edit events, sometimes things just act weird, like some logic is ignored. I save before testing then reload before doing anything now, just to avoid issues like that.
Maybe it's worth checking the initialize sprite event, maybe there's some leftover code in there causing problems.
|
|
|
Post by BiNMaN on May 29, 2015 19:28:34 GMT
I'm right at the star of this version, all that's in is player movement, bullet movement and I'm just starting the enemy spawning. I'm baffled, especially when I see good games getting made and mine cock up and I end up leaving a project alone.
I've only made one full game and I had to redo that 4 times because something went wrong and it stopped working.
|
|
|
Post by andrewvanbeck on May 29, 2015 19:50:54 GMT
I know your pain... had a couple of projects just die on me, now I'm sure it's best to be overly cautious, only testing the game after saving, incrementing file names every few changes etc etc. It pays to have all the events coded before adding too many sprites and blocks I think, especially when you have to delete stuff to be able to edit code. I also started using ZX Paintbrush to draw sprites etc, just a shame that it makes animating that little bit more difficult.
BTW what emulator are you using?
I had more issues with Spin, and ZX32 than I do now, using Spectaculator, which I really like, especially the virtual tape drive.
|
|
|
Post by BiNMaN on May 29, 2015 21:42:50 GMT
I use specemu, it's considered to be the most accurate just been updated adding joystick support at last
I've had it running against real hardware and every quirk and error a real machine produces (whatever model), specemu is exactly the same
perhaps it's a little too good!!
|
|
|
Post by BiNMaN on Jun 6, 2015 7:10:13 GMT
hmmm it would appear that writing a little program the if image.. condition works, I wonder if using the main loop to spawn enemy sprites (as in tea and sympathy) is causing the problem?
|
|
|
Post by andrewvanbeck on Jun 8, 2015 13:45:10 GMT
Maybe, I think if you spawn from a main loop it just uses the last sprite to spawn from, but if that sprite is deleted or if there's simply no sprites to spawn from, that could cause real issues I think. I spawn from the main loop in 48k box, but every level has a sprite on it before any enemies are spawned.
|
|