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

Sign In

Register
*Usernames are case-sensitive
Forgot my password

I need help with BG collision

  • #1 ✎ 4 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 ✎ 519 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
  • #3 ✎ 163 MochaProbably Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Drawing I like to draw! Hobbies Well for starters you can stop using label loops and labels and instead use while loops and functions Posted
  • #4 ✎ 69 GreedyGoat8 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Avatar Block I didn't change my avatar for 30 days. Website Disguised Hidden Website
    Well for starters you can stop using label loops and labels and instead use while loops and functions
    B-u-r-n. I'm curious though. Your programs layout and style indicates a platformer. I don't think random_guys recommendation would work. It could be similar, but with a few modifications.
    Posted Edited by GreedyGoat8