I need help with BG collision (Page 1) ● SmileBASIC Source Forums

Register
• #1 ✎ 8 Im_Old_Man Video Games I like to play video games! Hobbies Night Person I like the quiet night and sleep late. Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength How would I put in collision into my game? Here's the code: ```ACLS XON EXPAD SPDEF 0,0,0,16,32,16,16,1 SPDEF 1,16,0,16,32,16,16,1 SPDEF 2,32,0,16,32,16,16,1 SPDEF 3,0,0,16,32,16,16,9 SPDEF 4,16,0,16,32,16,16,9 SPDEF 5,32,0,16,32,16,16,9 LOAD "GRP4:SP",0 LOAD "GRP0:BG",0 SPSET 0,0 SPSCALE 0,2,2 X=50 Y=160 @0 IF X<28 THEN X=28 IF X>405 THEN X=405 IF Y<118 THEN Y=118 VSYNC SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF BUTTON AND #B THEN GOSUB @JUMP GOTO @0 @MR1 ANIM=ANIM+2 IF ANIM==10 THEN SPCHR 0,0 IF ANIM==20 THEN SPCHR 0,1 IF ANIM==30 THEN SPCHR 0,0 IF ANIM==40 THEN SPCHR 0,2 IF ANIM>40 THEN ANIM=0 OLD=629:LFT=FALSE X=X+2 RETURN @ML1 ANIM=ANIM+2 IF ANIM==10 THEN SPCHR 0,3 IF ANIM==20 THEN SPCHR 0,4 IF ANIM==30 THEN SPCHR 0,3 IF ANIM==40 THEN SPCHR 0,5 IF ANIM>40 THEN ANIM=0 OLD=629:LFT=FALSE X=X-2 RETURN @JUMP VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y-6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 VSYNC 1.5 SPOFS 0,X,Y IF BUTTON AND #RIGHT THEN GOSUB @MR1 IF BUTTON AND #LEFT THEN GOSUB @ML1 IF Y<118 THEN Y=118 Y=Y+6 RETURN ``` Posted
• #2 ✎ 602 random_god Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Here is a nice code if your player is moving around the screen: ``` while 1 if bgget(layer,px variable+16,py variable,1)==background number then dec y if bgget(layer,px variable,py variable+16,1)==background number then dec x if bgget(layer,px variable+16,py+32 variable,1)==background number then inc y if bgget(layer,px variable+32,py variable+16,1)==background number then inc x wait wend ``` Posted