Jump to content



1

PULSAR SUBROUTINE


7 replies to this topic

#1 orion1052003 OFFLINE  

orion1052003

    Chopper Commander

  • 140 posts

Posted Fri Sep 30, 2011 11:02 PM

Is there some way to make this better? How can you control the length of time this "enemy" stays on screen?


1100 SUB PULSAR
1110 CALL CLEAR!TEST LINE
1120 CALL SCREEN(2)
1130 CALL CHAR(72,"804020100F080B0A0A0B080F1020408001020408F010D05050D010F008040201")
1140 P=7 :: CALL MAGNIFY(3)
1150 CALL SPRITE(#4,72,P,18,1,0,20)
1153 P=6 :: CALL COLOR(#4,P)
1160 FOR J=1 TO 8 :: FOR I=1 TO 7 :: P=7 :: CALL COLOR(#4,P) :: CALL SOUND(100,-1,I,2000,0) :: P=6 :: CALL COLOR(#4,P) :: NEXT I :: NEXT J
1165 FOR I=1 TO 100
1170 P=6 :: CALL COLOR(#4,P) :: P=7
1175 P=7 :: CALL COLOR(#4,P) :: P=6
1180 !ALL COINC(#1,#4,10,C)
1185 NEXT I
1190 GOTO 1190! TEST LINE
1200 SUBEND

Attached Files

  • Attached File  P=6.jpg   12.22K   8 downloads

Edited by orion1052003, Fri Sep 30, 2011 11:07 PM.


#2 matthew180 OFFLINE  

matthew180

    Stargunner

  • 1,242 posts
  • Location:Marshall, Michigan

Posted Sun Oct 2, 2011 10:11 PM

Generate a random number, then count it down every time through your game loop. When it reaches zero, remove the enemy.

#3 sometimes99er OFFLINE  

sometimes99er

    Stargunner

  • 1,922 posts
  • Location:Denmark

Posted Mon Oct 3, 2011 12:14 AM

If you're generally experimenting with 2 colors (not knowing their final values), here they are 6 and 7, then perhaps setting the values in the beginning of your program, like C1=6 and C2=7, could be used. Setting the value of P every time and right before you use it may only slow down execution.

For example
1140 P=7 :: CALL MAGNIFY(3)
1150 CALL SPRITE(#4,72,P,18,1,0,20)
would become
1140 CALL MAGNIFY(3)
1150 CALL SPRITE(#4,72,7,18,1,0,20)
etc.

In lines 1170 and 1175 you even set the value of P after the COLOR, but it's never used (overwritten).
1170 P=6 :: CALL COLOR(#4,P) :: P=7
1175 P=7 :: CALL COLOR(#4,P) :: P=6

:)

#4 orion1052003 OFFLINE  

orion1052003

    Chopper Commander

  • 140 posts

Posted Mon Oct 3, 2011 7:18 PM

1150 CALL SPRITE(#4,72,7,18,1,0,20) You don't have to keep 7 as P to allow the sprite to change colors? 1150 CALL SPRITE(#4,72,P,18,1,0,20)
It seemed like the other day, when I had 6 or 7 in the CALL SPRITE statement it would only stay one color and when I plugged in a variable it changed colors back and forth, PULSATING, when I did 1170 P=6 :: CALL COLOR(#4,P) and 1175 P=7 :: CALL COLOR(#4,P).

1170 should be changed to this?

10 P1=6 :: P2=7

1170 CALL COLOR(#4,P1)
1175 CALL COLOR(#4,P2)

#5 unhuman OFFLINE  

unhuman

    Dragonstomper

  • 784 posts
  • Location:Vienna, VA

Posted Mon Oct 3, 2011 7:40 PM

This is a pretty cool effect. The noise is annoying, but I like the sonar.

#6 orion1052003 OFFLINE  

orion1052003

    Chopper Commander

  • 140 posts

Posted Mon Oct 3, 2011 10:22 PM

I changed it to the below, but it no longer works. The sound is remmed out, but there is an error and it stops at 1150.

1100 SUB PULSAR
1130 CALL CHAR(72,"804020100F080B0A0A0B080F1020408001020408F010D05050D010F008040201")
1140 !ALL MAGNIFY(4)
1150 CALL SPRITE(#4,72,6,18,1,0,20)
1160 !OR J=1 TO 8 :: FOR I=1 TO 7 :: P=7 :: CALL COLOR(#4,P):: CALL SOUND(100,-1,I,2000,0):: P=6 :: CALL COLOR(#4,P):: NEXT I :: NEXT J
1165 FOR I=1 TO 100
1170 CALL COLOR(#4,P1) :: CALL COLOR(#4,P2)
1180 !ALL COINC(#1,#4,10,C)
1185 NEXT I
1190 GOTO 1190
1200 SUBEND

#7 sometimes99er OFFLINE  

sometimes99er

    Stargunner

  • 1,922 posts
  • Location:Denmark

Posted Tue Oct 4, 2011 12:03 AM

View Postorion1052003, on Mon Oct 3, 2011 7:18 PM, said:

1150 CALL SPRITE(#4,72,7,18,1,0,20) You don't have to keep 7 as P to allow the sprite to change colors? 1150 CALL SPRITE(#4,72,P,18,1,0,20)
It seemed like the other day, when I had 6 or 7 in the CALL SPRITE statement it would only stay one color and when I plugged in a variable it changed colors back and forth, PULSATING, when I did 1170 P=6 :: CALL COLOR(#4,P) and 1175 P=7 :: CALL COLOR(#4,P).

1170 should be changed to this?

10 P1=6 :: P2=7

1170 CALL COLOR(#4,P1)
1175 CALL COLOR(#4,P2)
Yes.

#8 sometimes99er OFFLINE  

sometimes99er

    Stargunner

  • 1,922 posts
  • Location:Denmark

Posted Tue Oct 4, 2011 12:08 AM

View Postorion1052003, on Mon Oct 3, 2011 10:22 PM, said:

I changed it to the below, but it no longer works. The sound is remmed out, but there is an error and it stops at 1150.

1100 SUB PULSAR
1130 CALL CHAR(72,"804020100F080B0A0A0B080F1020408001020408F010D05050D010F008040201")
1140 !ALL MAGNIFY(4)
1150 CALL SPRITE(#4,72,6,18,1,0,20)
1160 !OR J=1 TO 8 :: FOR I=1 TO 7 :: P=7 :: CALL COLOR(#4,P):: CALL SOUND(100,-1,I,2000,0):: P=6 :: CALL COLOR(#4,P):: NEXT I :: NEXT J
1165 FOR I=1 TO 100
1170 CALL COLOR(#4,P1) :: CALL COLOR(#4,P2)
1180 !ALL COINC(#1,#4,10,C)
1185 NEXT I
1190 GOTO 1190
1200 SUBEND
As it is the value of P1 and P2 is zero. Think you forgot to set them with: 10 P1=6 :: P2=7

This seems to do it ...

10 P1=6 :: P2=7
20 CALL SCREEN(2)
1130 CALL CHAR(72,"804020100F080B0A0A0B080F1020408001020408F010D05050D010F008040201")
1140 CALL MAGNIFY(4)
1150 CALL SPRITE(#4,72,6,18,1,0,20)
1170 CALL COLOR(#4,P1) :: CALL COLOR(#4,P2)
1190 GOTO 1170





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users