Alright so I made a simple side-scroller type game with color coded collision. Using the point command. If the little guy hits black, gravity is 0, otherwise hes falling. So the collision detection has been working well untill I decided to use a picture I took with my camera and put ladders and walls everywhere so that it looks like your interacting with the picture. And for some reason detection is not working with JPGs... I took a closer look at my picture after I saved it and the true black (0,0,0) I painted over the picture with, was (0,1,0) and other variants. How can I stop this from happening?
I am using Paint to modify the picture.
Oh and heres my code
sync on
sync rate 100
load image "map2.jpg",1
paste image 1,0,0
load image "man.bmp",2
load image "grave.bmp",3
load image "portal1.bmp",4
load image "boost.bmp",5
load sound "beam.wav",1
load sound "tt.wav",3
load sound "explosion[1].wav",2
load image "explosion.bmp",6
hide mouse
do
if clicked=1 then goto skipp
xx=mousex()
yy=mousey()
skipp:
yyy=mousey()
xxx=mousex()
sprite 10,xx,yy,4
sprite 11,xxx,yyy,4
if clicked=1 and mouseclick() then remembery1=yyy : rememberx1=xxx : goto game1:
if mouseclick() then rememberx=xx : remembery=yy : clicked=1 : wait 500
sync
loop
game1:
do
sprite 10,rememberx,remembery,4
sprite 11,rememberx1,remembery1,4
if inkey$()="w" then goto cheat
sprite 1,x,y,2
if falltime>30 and point(x+15,y+20)=rgb(0,0,0) then paste image 3,x,y : sprite 1,x,y-20,6 : play sound 2 : wait 500 : x=0 : y=0 : falltime=0
gravity=4
`floor
if point(x+15,y+20)=rgb(0,0,0) then gravity=0 : rightspeed=3 : leftspeed=3 else gravity = 4 : rightspeed=1 : leftspeed=1
if point(x-1,y+20)=rgb(0,0,0) then gravity=0 : rightspeed=3 : leftspeed=3 else gravity = 4 : rightspeed=1 : leftspeed=1
if point(x+7,y+20)=rgb(0,0,0) then gravity=0 : rightspeed=3 : leftspeed=3 else gravity = 4 : rightspeed=1 : leftspeed=1
`walls
if point(x-1,y-1)=rgb(0,0,0) then leftspeed=0
if point(x+15,y-1)=rgb(0,0,0) then rightspeed=0
if point(x-1,y+10)=rgb(0,0,0) then leftspeed=0
if point(x+15,y+10)=rgb(0,0,0) then rightspeed=0
`ladders
if point(x+9,y+11)=rgb(255,0,0) then ladder=1 else ladder = 0
if ladder=1 then gravity=0
if rightkey() then inc x,rightspeed
if leftkey() then dec x,leftspeed
if spacekey() and gravity =0 then goto jump
if upkey() and ladder=1 then dec y,3
if downkey() and ladder=1 then inc y,3
if gravity=4 then inc falltime else falltime=0
if sprite hit(1,10) then x=rememberx1 : y=remembery1 : play sound 1
inc y,gravity
sync
loop
jump:
g=5
fx=x
fy=y
do
dec y,g
dec g,1
if y=fy or point(x+10,y+20)=rgb(0,0,0) then goto game1
if point(x-1,y+20)=rgb(0,0,0) then ll=0 else rr=3
if point(x+15,y+10)=rgb(0,0,0) then rr=0 else ll=3
if rightkey() then inc x,rr
if leftkey() then dec x,ll
play sound 3
sprite 1,x,y,5
sync
loop
cheat:
do
if inkey$()="w" then dec y,3 else goto game1
sprite 1,x,y,5
if rightkey() then inc x,4
if leftkey() then dec x,4
sync
loop
Read Ender's Game. And all its sequels.