leocz
Menagerie
Posts: 10
|
Post by leocz on Nov 2, 2013 14:41:25 GMT
Hi guys, I have pretty good game, but I wanted to add shot (fire) left / right and I could not do it, the gun would be a knife, which would have a sprite 11 and 12 (left yand right), and the type of Sprite 7 would not as the code. Surely I have to use the SPAWN and DIRECTION The shot would be similar to Ghost 'n Goblins I had thought a code how this:
If key =4 if direction =1 spawn 7 11 else spawn 7 12 endif endif
But it does not work, also not good as in the Sprite code type 7. Know any way to do this type of shot?
|
|
|
Post by alessandro on Nov 2, 2013 23:41:10 GMT
Hi leocz, in Apulija-13 I have Corporal Jonlan fire a bullet, which is a sprite itself, in four directions. The action is triggered by key 4 and each shot produces a very short noise. I did not use ELSE but a distinct IF...ENDIF cycle for each possible direction Jonlan is facing. Here is an excerpt of the code for the player character sprite: IF KEY 4 [...] BEEP 20 IF DIRECTION 0 SPAWN 1 4 ENDIF IF DIRECTION 1 SPAWN 1 5 ENDIF IF DIRECTION 2 SPAWN 1 6 ENDIF IF DIRECTION 3 SPAWN 1 7 ENDIF [...] ENDIF
Sprite event 1 is reserved to the bullet behavior, while sprite images 4-7 are those of the bullet shown in the four directions (try playing the game to see this effect in action). Hope that helps.
|
|
leocz
Menagerie
Posts: 10
|
Post by leocz on Nov 3, 2013 15:41:02 GMT
Hi Alessandro, thanks! for replying, I was testing Apulija-13 game and the shot is excellent in four directions!, is a professional game, the idea is that although only in 2 directions. I had a error in the code, and that made the shot out in one direction, but I corrected it and it worked perfectly. I was going crazy this ;D. Also works if you use IMAGE instead of DIRECTION. The idea of the game is to start without the gun, but it would be very easy to the game, and take it to some final screen. Is there any way to do this?, That is, to take the given object enable me the gun. Probe with GOT option but not how it works. Thank you very much for the help. In the video you can see how the shot. Attachments:
|
|
leocz
Menagerie
Posts: 10
|
Post by leocz on Nov 3, 2013 22:42:09 GMT
The idea of the game is to start without the gun, but it would be very easy to the game, and take it to some final screen. Is there any way to do this?, That is, to take the given object enable me the gun. Probe with GOT option but not how it works. I know how to use the GOT function, my mistake was to put IF GOT = 4, and is without an equal IF GOT 4, where 4 is the number of object to enable shooting in my case. Sorry.. was something stupid
|
|
|
Post by alessandro on Nov 4, 2013 11:58:36 GMT
Don't worry, we must learn from our errors Glad to have been of some help to you. Your new game looks very nice, I hope you will complete it soon. Unfortunately, my current project lags behind - I have very little time these days to dedicate to Spectrum game development
|
|
leocz
Menagerie
Posts: 10
|
Post by leocz on Nov 6, 2013 22:53:06 GMT
Now I have new problem , I put a counter of 29 shots, works perfect, but when I'm in a screen that use PUTBLOCK, they are corrupt. This does not happen if I delete DISPLAY F (F is variable of shots or bullets count). It seems that DISPLAY and PUTBLOCK do not get along in my case. To be more clearly, put a video, the first showing shutter count with DISPLAY F. And the second video without DISPLAY F. The code in Sprite type 0 is: detectobj if obj <> 255 get obj if got 4 let O=4 let F=20 (bullets) endif endif if key 4 if got O if direction =1 spawn 7 11 subtract 1 from F else spawn 7 12 subtract 1 from F endif if F=0 let O =N (Stop fire wiyh zero bullets) endif endif
For the opening mechanism PUTBLOCK
If custom let line =3 let column=12 putblock 49 let line =1 let column=22 putblock 0 (cero) .... etc endif
Any idea what could be wrong? Thanks! Attachments:
|
|
leocz
Menagerie
Posts: 10
|
Post by leocz on Nov 6, 2013 22:55:04 GMT
You may need to use the command DIG to remove blocks FODDER, but I was testing the DIG command values of 0-3, and no fodder blocks disappear . As I can use that command? The second video, was missing from the previous answer Attachments:
|
|