@Sven B:
Quote: "
At line 107, it says clone object 2000,2001, I think it should be clone object 2001, 2000 (clone object object, source)
And at line 558 it says dot px+,py. I think it's just my compiler or something, but it gives an error with the +...
Beside that I also got an error with the variable "max" since I have a plugin with that command.
"
- Replaced "clone" by "make object"
- before I copied it via clipboard it was 'px+1' I removed the +1 now
- variable max renamed to mx
@Bongadoo
Quote: "and also the camera points straight down for me"
- There are two cams the normal control-cam and the drop-cam. The drop cam shows the falling gift while
it is drooped but the sprite with the drop-cams picture should be off screen when you are not dropping...
try to change to windowed mode, you must only remove the "remstart" & "remend" on lines 21 & 27.
@Jammy
Quote: "Will the game get harder ? - Perhaps Less time to delever Gift as you progress through levels ?"
- The timer will decrease faster with each round played
@all
The snow is randomized from circles and dots, if you got a better idea I'm open to change the drawing routine.
(to prevent cut/paste problems I will attach the source as .txt-file)
Here it is the "enhanced" version:
remstart
******************************************************************************************************************
Santas gift delivery by Attila 2007
help santa deliver his gifts, you will deliver 10 gifts to the houses indicated by
yellow arrows. You will deliver all gifts in 150 seconds, or loose the game.
Use the arrow-keys to accelerate, break and turn left or right your sledge.
Drop the gifts using the space key. While droppping a camera in the right upper corner
shows the falling gift.
If you hit the house you will get a paket too.
******************************************************************************************************************
remend
set display mode 640,480,16
randomize rnd(timer()+mousex()+mousey())
`
` uncomment following lines for windows mode
`
remstart
set window on
set window title "Merry Christmas"
set window position 320,240
set window layout 1,1,1
restore window
remend
set text transparent
set text font "Verdana"
set text size 18
set text to bold
backdrop on
color backdrop rgb(0,0,64)
hide mouse
`set ambient light 100
fog on
fog color rgb(96,96,128)
fog distance 450
autocam off
type NotenRecord
note as integer
speed as integer
volume as integer
endtype
dim master_note(-1) as NotenRecord
dim cx#(10)
dim cz#(10)
dim co(10)
ccnt=0
` some music
CreateMidi("bing",13,7,"q c5 r r r q")
CreateMidi("wewishyou",25,7,"q g4 c5 r c5 d5 q c5 b4 a4 r a4 r r a4 d5 r d5 e5 d5 c5 b4 r g4 r g4 r e5 r e5 f5 e5 d5 c5 r a4 r g4 g4 a4 r d5 r b4 r c5 r r q")
load music "wewishyou.mid",1
load music "bing.mid",2
loop music 1
set music volume 1,70
makeIntro(9)
sprite 9,0,0,9
sync on
sync rate 0
`sledge(100)
te=timer()+10000
`instrument 11 = cowbell
`
MakeBitmap("SNOW",12)
MakeBitmap("BRANCH",10)
MakeBitmap("BARK",11)
MakeBitmap("GROUND",13)
MakeBitmap("HOUSE",14)
MakeBitmap("ROOF",15)
MakeBitmap("FIREPLACE",16)
MakeBitmap("COVER",17)
MakeBitmap("SKY",18)
create bitmap 25,150,20
set current bitmap 25
ink rgb(255,64,0),0
box 0,0,150,20
ink rgb(255,255,0),0
line 0,5,150,5
get image 25,0,0,150,20
set current bitmap 0
load bitmap "Gift01.jpg",20
set current bitmap 20
get image 19,62,80,116,128
set current bitmap 0
make matrix 1,1000,1000,20,20
prepare matrix texture 1,13,1,1
randomize matrix 1,25
update matrix 1
`Skybox
make object plain 2000,1000,500
texture object 2000,18
position object 2000,500,250,1000
make object plain 2001,1000,500
yrotate object 2001,180
position object 2001,500,250,0
make object plain 2002,1000,500
texture object 2002,18
yrotate object 2002,270
position object 2002,1000,250,500
make object plain 2003,1000,500
texture object 2003,18
yrotate object 2003,90
position object 2003,0,250,500
y1#=get ground height(1,500,500)
MAKE SNOW PARTICLES 1, 12, 3550, 500,y1#+10,500, 50, 35, 50
` Ceate the x-mas trees
no=100
` Tree(s)
for tree=0 to 20
px=500+(rnd(150)-75)
pz=500+(rnd(150)-75)
y2#=get ground height(1,px,pz)
oldeh=0
for n=0 to 2
for h=1 to 180 step 30
make object plain no,6-n,4-n
texture object no,10
if n=0 then eh=3
if n=1 then eh=5
if n=2 then eh=6.5
position object no, px,y2#+eh,pz
yrotate object no,h
set object transparency no,1
set object cull no,0
no=no+1
next h
next n
next tree
` House
for h=1 to 10
make object box no,10,6,7
texture object no, 14
ok=0
while ok=0
px=500+(rnd(150)-75)
pz=500+(rnd(150)-75)
sync
y2#=get ground height(1,px,pz)
position object no,px,y2#+3,pz
if object collision (no,0)
ok=0
else
ok=1
endif
endwhile
co(ccnt)=no
cx#(ccnt)=px
cz#(ccnt)=pz
no=no+1
`Roof
make object box no,9.8,5.7,5.7
xrotate object no, 45
position object no,px,y2#+5.5,pz
texture object no,15
no=no+1
make object box no, 2,10,3
texture object no, 16
position object no, px+6,y2#+5,pz
no=no+1
make object box no, 2,.1,3
texture object no, 17
position object no, px+6,y2#+10.05,pz
ccnt=ccnt+1
no=no+1
next h
mx=no-1
r#=0
while timer() < te
sleep 1
sync
endwhile
delete sprite 9
` Visor
make object box 1,8,.1,8
boxtexture(20)
texture object 1,20
set object transparency 1,1
set object cull 1,0
`xrotate object 1,wrapvalue(-45)
yg#=get ground height(1,500,500)
position object 1, 500,yg#+5,500
` Arrow
make object box 2,3,5,3
set current bitmap 20
get image 21,1,2,6,4
texture object 2,21
set current bitmap 0
make object box 3,2.9,3,3
xrotate object 3,45
texture object 3,21
position object 2 ,cx#(0),37,cz#(0)
position object 3 ,cx#(0),35.6,cz#(0)
load object "Gift01.x", 10
scale object 10,3,3,3
x#=500
z#=490
r#=atanfull(cx#(0)-x#,cz#(0)-z#)
speed#=.1
position camera x#,y1#+50,z#
make camera 1
position camera 1, 208,sh+3,208
set camera to image 1,1,256,256
` Position the Sprite (Output Screen) right/top
lp=screen width()+1
sprite 1,lp,-30,1
size sprite 1, 256,192
create bitmap 25,150,20
set current bitmap 25
ink rgb(255,0,0),0
box 0,0,150,20
get image 25,0,0,150,20
set current bitmap 0
create bitmap 26,154,40
set current bitmap 26
ink rgb(0,0,200),0
box 0,0,154,40
ink rgb(255,255,0),0
set text size 13
text 5,3,"Remaining time"
get image 26,0,0,154,40
set current bitmap 0
sprite 26,5,screen height()-67,26
sprite 25,7,screen height()-50,25
size sprite 25,150,20
lvl=-1
Restart:
lvl=lvl+1
clear entry buffer
tr=0
drop=0
Treffer=0
st=timer()
clear entry buffer
while -1
if spacekey() and drop=0
rp#=r#
sp#=speed#
py#=y#+8
lp=screen width()-256
drop=-1
fs#=.1
sleep 1
endif
if drop=-1
dpz#=cos(rp#)
dpx#=cos(90-rp#)
zp#=z#+sp#*dpz#
xp#=x#+sp#*dpx#
py#=py#-fs#
yrotate object 10,wrapvalue(r#+180)
position object 10,xp#,py#,zp#
if fs# < 1 then fs#=fs#*1.2
set camera to follow 1,xp#,py#,zp#,r#+90,9,py#+5,35,1
point camera 1,xp#,py#,zp#
gh#=get ground height(1,xp#,zp#)
if object collision(10,co(tr))
if not music playing(2) then play music 2
set music volume 2, 120
tr=tr+1
drop=0
lp=screen width()+1
sprite 50+Treffer,Treffer*58,0,19
sync
Treffer=Treffer+1
dpz#=cos(r#)
dpx#=cos(90-r#)
zp#=z#+10*dpz#
xp#=x#+10*dpx#
zp#=z#
xp#=x#
yrotate object 10,wrapvalue(r#+180)
position object 10,xp#,y#+2.0,zp#
set camera to follow 1,xp#,y#+4,zp#,r#+90,9,42,15,1
sprite 1,lp,-30,1
if treffer >= 9 then goto win
endif
if py# <= (gh#-10) and drop=-1
drop=0
lp=screen width()+1
sleep 500
ts=ts-5000
endif
else
dpz#=cos(r#)
dpx#=cos(90-r#)
zp#=z#+10*dpz#
xp#=x#+10*dpx#
zp#=z#
xp#=x#
yrotate object 10,wrapvalue(r#+180)
position object 10,xp#,y#+4.0,zp#
set camera to follow 1,xp#,y#+4,zp#,r#+90,9,42,15,1
` position camera 2,xp#,y#+4,zp#
` yrotate camera 2,wrapvalue(r#+180)
` point camera 2,xp#,0,zp#
endif
position object 2 ,cx#(tr),37,cz#(tr)
position object 3 ,cx#(tr),34.6,cz#(tr)
sprite 1,lp,-30,1
if rightkey() then r#=r#+1.2
if leftkey() then r#=r#-1.2
if upkey() then speed#=speed#+.01
if downkey() then speed#=speed#-.01
if speed# < 0 then speed#=0
if speed# > 1.5 then speed#=1.5
oldx#=x#
oldz#=z#
dz#=cos(r#)
dx#=cos(90-r#)
di#=sqrt((x#-500)*(x#-500)+(z#-500)*(z#-500))
if di# > 250 then r#=r#+2
dz#=cos(r#)
dx#=cos(90-r#)
z#=z#+speed#*dz#
x#=x#+speed#*dx#
y#=get ground height(1,px#,z#)+35
y#=40
position object 1,x#,y#,z#
yrotate object 1,wrapvalue(r#)
set camera to follow 0,x#,y#,z#,r#+5,5,y#+2,15,1
point camera x#,y#,z#
position particles 1,x#,y#+6,z#
ink rgb(0,0,128),0
t=150-int((timer()-st)/1000)-(lvl/2)
if t < 0 then goto lost
size sprite 25,t+1,20
ink rgb(0,0,255),0
sync
endwhile
end
lost:
for h=50 to 61
if sprite exist(h) then delete sprite h
next h
set text size 84
center text 320,240,"you loose"
set text size 32
center text 320,340,"press any key to restart or esc to exit"
sync
clear entry buffer
suspend for key
goto Restart
end
win:
for h=50 to 61
if sprite exist(h) then delete sprite h
next h
set text size 84
center text 320,240,"you win"
set text size 32
center text 320,340,"press any key to restart or esc to exit"
sync
clear entry buffer
suspend for key
goto Restart
end
function boxtexture(nr)
create bitmap nr,128,128
set current bitmap nr
ink rgb(255,32,0),0
box 0,0,128,128
ink rgb(255,255,0),0
box 2,2,126,4
box 2,124,126,126
box 2,2,4,126
box 124,2,126,126
ink rgb(0,0,0),0
box 6,6,122,122
ink rgb(0,0,32),0
line 63,6,63,122
line 64,6,64,122
line 65,6,65,122
line 6,63,122,63
line 6,64,122,64
line 6,65,122,65
get image nr,0,0,128,128
set current bitmap 0
sync
endfunction
function MakeBitmap(N$,nr)
create bitmap nr,128,128
set current bitmap nr
if n$="SKY"
randomize timer()
ink rgb(128,128,255),0
box 0,0,128,128
for n=1 to 120
px=rnd(256)-64
py=rnd(128)
m=rnd(20)+5
for h=1 to m
ink rgb(255-m,255-m,255),1
ellipse px,py,h,2*h/3
next h
next n
endif
if n$="COVER"
ink rgb(164,164,164),0
box 0,0,128,128
ink rgb(0,0,0),0
box 10,10,118,118
endif
if n$="FIREPLACE"
ink rgb(164,164,164),0
box 0,0,128,128
ink rgb(16,16,16),0
for h=1 to 128 step 12
line 0,h,128,h
next h
endif
if n$="ROOF"
ink rgb(164,32,0),0
box 0,0,128,128
ink rgb(255,255,1255),0
for h=-128 to 128 step 20
line h,0,h+128,128
next h
for h=256 to 1 step -20
line h,0,h-128,128
next h
endif
if n$="HOUSE"
ink rgb(164,164,0),0
box 0,0,128,128
ink rgb(16,16,128),0
for h=1 to 128 step 12
line 0,h,128,h
next h
ink rgb(128,128,128),0
for h=2 to 128 step 12
line 0,h,128,h
next h
ink rgb(255,0,0),0
box 44,10,84,70
ink rgb(0,0,16),0
box 48,14,80,66
ink rgb(255,0,0),0
line 63,14,63,66
line 64,14,64,66
line 65,14,65,66
line 48,29,80,29
line 48,30,80,30
line 48,31,80,31
endif
if n$="BRANCH"
ink rgb(255,255,0),0
box 0,0,128,1
ink rgb(0,128,0),0
box 0,0,128,128
for h=1 to 1500
ink rgb(200,200,0),0
px=rnd(128)
py=rnd(128)
dot px,py
ink rgb(60,80,0),0
dot px-.5,py-.5
next h
ink 0,0
for h=1 to 64
box 0,0,h,2*(64-h)
next h
for h=1 to 64
box 64+h,0,128,2*(h)
next h
for h=0 to 128 step 8
line 64,h,h/2,128
line 64,h,128-h/2,128
next h
ink rgb(255,255,255),0
line 64,0,0,128
line 64,1,1,128
line 64,0,128,128
line 64,1,128,127
endif
if n$="GROUND"
ink rgb(240,240,243),0
box 0,0,128,128
for h=1 to 512
ink rgb(255,255,255),0
px=rnd(128)
py=rnd(128)
dot px,py
dot px+1,py+1
next h
for h=1 to 512
ink rgb(220,220,255),0
px=rnd(128)
py=rnd(128)
dot px,py
dot px+1,py-1
next h
for h=1 to 100
px=rnd(128)
py=rnd(128)
r=rnd(15)
for p1=0 to 2
ink rgb(255,255,255),0
circle px,py,r
ink rgb(255,255,255),0
circle px+1,py+1,r
next p1
next h
endif
if n$="SNOW"
ink rgb(0,0,0),0
box 0,0,128,128
ink rgb(255,255,255),0
for h=1 to 128 step 10
line h,0,128-h,128
line 0,h,128,128-h
next h
ink rgb(0,0,0),0
for r=64 to 128
circle 64,64,r
next h
endif
if n$="BARK"
ink rgb(64,64,0),0
box 0,0,128,128
for h=1 to 1500
ink rgb(220,220,0),0
px=rnd(128)
py=rnd(128)
ink rgb(128,96,0),0
dot px,py
for n1=0 to 5
dot px,py+n1
next n1
dot px,py
for n1=0 to 5
dot px+1,py+n1
next n1
next h
endif
`for h=1 to 20:ink rgb(189,120,36),0:px=rnd(128):py=rnd(128):for h1=1 to 10:circle px,py,h1:next h1:next h:endif
get image nr,0,0,128,128
set current bitmap 0
sync
endfunction
function MakeIntro(nr)
create bitmap nr,640,480
set current bitmap nr
ink rgb(250,250,255),0
box 0,0,640,480
ink rgb(196,196,255),1
for h=1 to 2000
px=rnd(640)
py=rnd(480)
line px,py,px+4,py+4
line px+4,py+4,px,py+4
line px+2,py,px+2,py
next h
set text size 64
set text to bold
ink rgb(128,128,255),0
center text 319,80,"merry Christmas"
ink rgb(32,32,32),0
center text 323,82,"merry Christmas"
ink rgb(255,64,32),0
center text 321,81,"merry Christmas"
set text size 32
ink rgb(128,128,255),0
center text 319,200,"take control of Santas sledge!"
ink rgb(164,164,255),0
center text 321,201,"take control of Santas sledge!"
ink rgb(128,128,255),0
center text 319,240,"use arrow-key to control speed"
ink rgb(164,164,255),0
center text 321,241,"use arrow-key to control speed"
ink rgb(128,128,255),0
center text 319,274,"and direction. Use space to drop gift."
ink rgb(164,164,255),0
center text 321,275,"and direction. Use space to drop gift."
ink rgb(128,128,255),0
center text 319,310,"Target is indicated by arrow"
ink rgb(164,164,255),0
center text 321,311,"Target is indicated by arrow"
ink rgb(128,128,255),0
center text 320,430,"(C) 2007 by Attila"
ink rgb(32,32,255),0
center text 321,431,"(C) 2007 by Attila"
get image nr,0,0,640,480
set current bitmap 0
set text size 12
sprite nr,0,0,nr
sync
endfunction
function CreateMidi(file as string,instrument as integer,tempo as integer,notes as string)
remstart
Base of this procedure was posted on 23rd Dec 2006 by Hobgoblin Lord in TGC Forums
remend
SPEED=165
notes=" "+notes
for a = 1 to len(notes)
watch$=mid$(notes,a)
if watch$=" "
start=a:test_note$=""
repeat
inc start
new$=mid$(notes,start)
if new$<>" "
test_note$=test_note$+new$
endif
until new$=" " or start=len(notes)
note_on=1
if len(test_note$)=1
select lower$(test_note$)
case "q":SPEED=135:endcase
case "8":speed=134:endcase
case "h":speed=140:endcase
case "r":array insert at bottom master_note():count=array count(master_note())
master_note(count).note=0:master_note(count).speed=SPEED:master_note(count).volume=0
endcase
endselect
note_on=0
else
temp_note$=left$(test_note$,1):temp_octave=val(right$(test_note$,1))
select lower$(temp_note$)
case "c":note_base=0:endcase
case "d":note_base=2:endcase
case "e":note_base=4:endcase
case "f":note_base=5:endcase
case "g":note_base=7:endcase
case "a":note_base=9:endcase
case "b":note_base=11:endcase
endselect
inc note_base,Temp_octave*12
if len(test_note$)=3 then inc note_base
endif
if note_on=1
array insert at bottom master_note()
count=array count(master_note())
master_note(count).note=note_base
master_note(count).speed=SPEED
master_note(count).volume=127
endif
endif
next a
`figure bytes in the track
track_total=20+((array count(master_note())+1)*9)
if file exist("making_bytes.txt")=1 then delete file "making_bytes.txt"
open to write 1,"making_bytes.txt"
write long 1,track_total
close file 1
open to read 1,"making_bytes.txt"
read byte 1,track_bytesD
read byte 1,track_bytesc
read byte 1,track_bytesB
read byte 1,track_bytesA
close file 1
if file exist("making_bytes.txt") then delete file "making_bytes.txt"
`create the actual midi file
file=file+".mid"
if file exist(file)=1 then delete file file
open to write 1,file
`write the header
write byte 1,77:write byte 1,84:write byte 1,104:write byte 1,100:write byte 1,0:write byte 1,0:write byte 1,0:write byte 1,6
write byte 1,0:write byte 1,0:write byte 1,0:write byte 1,1
`write track header
write byte 1,TEMPO:write byte 1,192
`affects duration
write byte 1,77:write byte 1,84:write byte 1,114:write byte 1,107
`number of bytes in the track
write byte 1,track_bytesa:write byte 1,track_bytesb:write byte 1,track_bytesc:write byte 1,track_bytesd
`instrument and delta set up
write byte 1,0:write byte 1,192:write byte 1,INSTRUMENT
`instrument
write byte 1,0:write byte 1,255:write byte 1,89:write byte 1,2:write byte 1,0:write byte 1,0:write byte 1,0:write byte 1,255:write byte 1,81:write byte 1,3:write byte 1,9:write byte 1,39:write byte 1,192:write byte 1,0
`write the notes
`turn the note on
for count = 0 to array count(master_note())
write byte 1,144:write byte 1,master_note(count).note:write byte 1,master_note(count).volume:write byte 1,master_note(count).speed:write byte 1,64
`turn it off
write byte 1,128:write byte 1,master_note(count).note:write byte 1,0:write byte 1,0
next count
`write track end
write byte 1,255,:write byte 1,47,:write byte 1,0,:write byte 1,1
close file 1
endfunction