0 Members and 2 Guests are viewing this topic.
If getKey(27) and (R=0) and (B<10) .MAKE NEW BULLET 22->R B+1->B*6+50+L1->I Y->{I} X->{I-1} .SET SIGNS / WIDTH / HEIGHT (1 being positive, 0 being negitive) If Y>Z 0->{I-2} Y-Z->J Else 1->{I-2} Z-Y->J End If X>W 0->{I-3} X-W->K Else 1->{I-3} W-X->K End .ANGLE tan^-1(K,J)->{I-4} .VELOCITY 1->{I-5}End.BUL_PROCESSFor(I,1,B) 6*I+50+L1->J .FIND NEW DISPLACEMENT VIA ANGLE/HYP (VELOCITY) cos({J-4})/127*{J-5}->K .This is where I have no idea what I am doing sin({J-4})/127*{J-5}->L .UPDATE POSITION BASED ON SIGN If {J-2} K+{J}->{J} Else K-{J}->{J} End If {J-3} L+{J-1}->{J-1} Else L-{J-1}->{J-1} End .REMOVE OUT OF BOUNDS If ({J}=57) or ({J}=0) or ({J-1}=89) or ({J-1}=0) Copy(6*B+50+L1,J,6)^^r B-- I-- EndEnd
Like I guess that 127 is supposed to represent the value 1 and -127 as -1, but I don't know how I would make a conversion like that inside code.
Well... divide by 127 ?Be sure though not to divide right after you made the (co)sine calculation or you'll always get 0 or 1 or -1. For example, if you have to do sin(a)*r, do sin(a)*r/127 and not sin(a)/127*r.Also, if you don't care about losing a bit of precision, divide by 128 instead of 127. It is a less ugly number.
x coordy coordwidthheightremainder
for(a=0,#ofbullets-1) call AdjustCoords pxl-change(x,y) x?buf(5*a) y?buf(5*a+1) w?buf(5*a+2) h?buf(5*a+3) r?buf(5*a+4)AdjustCoords:buf(5*a)?xbuf(5*a+1)?ybuf(5*a+2)?wbuf(5*a+3)?hbuf(5*a+4)?rpxl-change(x,y)if remainder >0 x+1?x r-h?r returnIf remainder=<0 y+1?y r-w?r return