hi,
the pics were jpg and bmp. i made the jpg to bmp. that is accoording to darkbasic media models the same way.
the boxes are created in darkbasic and textured after.
The textures are 256x256. the boat, the car, and the horse are models from darkbasic media self.
i tested the win 7 version on my work. dont know if it is w7 pro.
could be an admininstration problem maybe.
i found out that on the C: dir a map appears calling: "dbTemp".
The midi file is stored in here as well as "one" texture, the goldone that makes the same texture on the boat it is called then _virtual.mid and _virtual.bmp.
in this map also is a file called "workfile.tmp". There is my source code hiding. dont know if that is oke when i run it in an exe.
I shall test it on an other pc with win7 that has not run the game. So the changes might work, like the jpg to bmp. and rgb(1,1,1) etc.
I made a random nummering so the cards will randomley placed on the screen every time i start the game.exe. But when i start the game.exe the cards are laying everytime in the same way when i restart the game.
If i start the game in dbc it starts the same. when i get out the coderunner and restart it in dbc the cards seems to be scrambled in an other order. So the rnd function seems to work oke then.
But.....
when i then close dbc and then restarts dbc en run the code again, the same principle starts all over. the first round is the same as above, the second after recompailing the game also the same as above.
so... it looks like my randoms are stored somewhere and i can't get them empty. (starts at my pc left top corner with card 12 every first time).
used undim etc.
don't know what i have done wrong. i shall put the code here.
Oke, the code is not a beauty price, but it works (can play onely once).
I am still finetuning the code.
when it is finished i can put the cards also with it. the cards are .x files. created and textured in wings.
I send numberd cards. so you can make your own cards and pics.
i also want to thank the people on the form for helping me and eachother out.
Rem * Title : Memory_Sint
Rem * Author : jr
Rem * Date : 01-11-2012
REM ********
REM *MEMORY*
REM ********
cls
oy#=1.5
set text opaque
perform checklist for display modes
t=checklist quantity()
dpmw=checklist value a(t)
dpmh=checklist value b(t)
dpmd=checklist value c(t)
if check display mode(dpmw,dpmh,dpmd)
set display mode dpmw,dpmh,dpmd
endif
`set display mode 1280,1024,32
`
`set display mode 1024,768,32
`set display mode 800,600,32
GOSUB load_start_game:
autocam off
sync on
sync rate 60
hide mouse
color backdrop rgb(255,0,0)
`cls rgb(255,0,0)
load bitmap "pics/sintenpiet.bmp"
`set current bitmap 22
get image 22,0,0,300,371
position camera -1.25,15,-10
`position camera -1.25,25,-10
point camera -1.25,0,-1.25
set text size 64
set text to bold
sw=screen width()/2
sh=screen height()/2
cls rgb(255,0,0)
sprite 1,sw,sh,22
offset sprite 1, sprite width(1)/2, sprite height(1)/2
sprite 1,sw,sh,22
`center text sw, sh , "Memory"
`blur bitmap 0,1
`paste image 22,sw*2,sh*2
`paste image 22,200,200
`paste image 2,2,screen width()/2,screen height()/2
`sprite 1,sw,sh,22
`get image 1,0,0,sw*2,sh*2
`paste image 1,sw*2,sh*2
wait key
COUNT=48
table_wood("models/wood10.bmp")
pakje("pics/papier/1.bmp",4444,5,5,5,10.0,2.5,10.0,10.0)
pakje("pics/papier/2.bmp",4445,4,4,4,0.0,2.5,9.0,-10.0)
pakje("pics/papier/3.bmp",4446,4,4,4,-10.0,2.5,10.0,110.0)
pakje("pics/papier/7.bmp",4448,6,6,6,-17.0,2.5,5.0,135.0)
load object "models/boat/boat.x",5000
load object "models/car/car.x",5001
load object "models/horse.x",5002
load object "models/lolypop.x",5003
position object 5000,-5,1,12
yrotate object 5000,wrapvalue(-60)
zrotate object 5000,wrapvalue(+50)
xrotate object 5000,wrapvalue(+60)
position object 5001,4.2,0.5,8.5
yrotate object 5001,wrapvalue(70)
position object 5002,9.5,2.2,3
scale object 5002,200,200,200
`position object 5002,8,4,10
yrotate object 5002,wrapvalue(70)
position object 5003,-12,0.7,0
scale object 5003,800,800,800
xrotate object 5003,90
zrotate object 5003,20
`GOSUB load_start_game:
gosub kaartladen:
win("models/win.x")
gosub kaartkeuze:
shadow()
start_game:
shuffle_player_start=rnd(1)+1
turn_player=shuffle_player_start
RETURN
`if game_end=1
` undim CARD(COUNT)
`endif
show_cards=2*cards_count
xcard#=-12.5
zcard#=5.0
SELECTED_CARD=1
SELECTED_CARD_OLD=1
SELECTED_CARD_Y=0
SELECTED_CARD_X=1
for n=1 to show_cards
if xcard#>5
xcard#=-12.5
zcard#=zcard#-2.5
endif
xcard#=xcard#+2.5
show object card(n)
position object card(n),xcard#,0.6,zcard#
next n
SELECTED_CARD=1
delete sprite 1
delete image 22
``loop``
repeat
`While escapekey()=0
` if inkey$()="p" and music looping(1)
` pause music 1
` while inkey$()="p"
` endwhile
` endif
` if inkey$()="p" and music paused(1)
` loop music 1
` while inkey$()="p"
` endwhile
` endif
` if game_end=1
` undim CARD(COUNT)
` game_end=0
` SCORE_PLAYER1=0
` SCORE_PLAYER2=0
`gosub start_game
` gosub kaartkeuze
` endif
set text size 20
set text to bold
player2$="SPELER 2: "+str$(SCORE_PLAYER2)
TEXT_WIDHT=text width(player2$)
SCREENWIDTH=screen width()-TEXT_WIDHT
gosub TURN_PLAYER_COLOR:
`if inkey$()="1" then game_end=1
remstart
if inkey$()="w"
move camera 0.50
endif
if inkey$()="s"
move camera -0.50
endif
if inkey$()="a"
xcam#=camera position x()-0.25
position camera xcam#,camera position y(),camera position z()
point camera -1.25,0,-1.25
endif
if inkey$()="d"
xcam#=camera position x()+0.25
position camera xcam#,camera position y(),camera position z()
point camera -1.25,0,-1.25
endif
remend
rem **********************
rem ****kies een kaart****
rem **********************
if spacekey() and (object visible(card(SELECTED_CARD))) and card(SELECTED_CARD)<>gamecard(1)
rem hier keert de kaart terug!! keuze 1 bewaren tot keuze 2 is genomen
cardstart=cardstart+1
yya#=1.5
` for n=1 to 45
for n=1 to 30
`yyya#=yya#+sin(wrapvalue(n*4))*1.5
yyya#=yya#+sin(wrapvalue(n*6))*1.5
position object card(SELECTED_CARD),object position x(card(SELECTED_CARD)) ,yyya#,object position z(card(SELECTED_CARD))
` anglez#=wrapvalue(anglez#+4)
anglez#=wrapvalue(anglez#+6)
rotate object card(SELECTED_CARD),0,0,anglez#
gosub TURN_PLAYER_COLOR
sync
next n
position object card(SELECTED_CARD),object position x(card(SELECTED_CARD)),oy#,object position z(card(SELECTED_CARD))
if cardstart=1
gamecard(1)=card(SELECTED_CARD)
anglez#=0
`gosub movecamera:
endif
``````````````````
if cardstart=2
gamecard(2)=card(SELECTED_CARD)
if abs(gamecard(1)-gamecard(2))=24
repeat
`set text opaque
`ink rgb(255,255,255),1
`CENTER TEXT screen width()/2,screen height()/2,"YOU'VE GOT A PAIR!!"
show object 102
` x_text=wrapvalue(x_text+2)
` rotate object 102,x_text,0,0
scaleobject=scaleobject+2
scale object 102,10+sin(wrapvalue(scaleobject))*1.0,10+sin(wrapvalue(scaleobject))*1.0,10+sin(wrapvalue(scaleobject))*1.0
`object size x(102)+sin(wrapvalue(scaleobject))*0.5,object size y(102),object size z(102)
gosub TURN_PLAYER_COLOR
sync
` until returnkey()=1
until spacekey()=1
returnpress=1
HIDE OBJECT 102
if turn_player=1
score_player1=score_player1+1
`turn_player=2
turn_player_win=1
else
score_player2=score_player2+1
`turn_player=1
turn_player_win=1
endif
TOTAL_SCORE=TOTAL_SCORE+1
hide object gamecard(1)
hide object gamecard(2)
endif
rem rotate cards back
anglez_a#=180
anglez_b#=180
if returnpress=0
repeat
gosub TURN_PLAYER_COLOR:
sync
until spacekey()
` returnpress=0
endif
if returnpress=1 THEN returnpress=0
`wait key
yy#=0.6
yya#=1.5
` position object gamecard(1),object position x(gamecard(1)),oy#,object position z(gamecard(1))
` for n=1 to 45
`yyy#=yy#+sin(wrapvalue(n*4))*1.5
`yyya#=yya#+sin(wrapvalue(n*4))*1.5
for n=1 to 30
yyy#=yy#+sin(wrapvalue(n*6))*1.5
yyya#=yya#+sin(wrapvalue(n*6))*1.5
position object gamecard(1),object position x(gamecard(1)) ,yyy#,object position z(gamecard(1))
position object gamecard(2),object position x(gamecard(2)) ,yyya#,object position z(gamecard(2))
` anglez_a#=wrapvalue(anglez_a#+4)
` anglez_b#=wrapvalue(anglez_b#+4)
anglez_a#=wrapvalue(anglez_a#+6)
anglez_b#=wrapvalue(anglez_b#+6)
rotate object gamecard(1),0,0,anglez_a#
rotate object gamecard(2),0,0,anglez_b#
gosub TURN_PLAYER_COLOR:
sync
next n
position object gamecard(1),object position x(gamecard(1)),oyo#,object position z(gamecard(1))
position object gamecard(2),object position x(gamecard(2)),oy#,object position z(gamecard(2))
gamecard(1)=0
gamecard(2)=0
cardstart=0
` if turn_player=1 or turn_player_win=2
` turn_player=2
` turn_player_win=0
` endif
` if turn_player=2 or turn_player_win=1
` turn_player=1
` turn_player_win=0
` endif
````````` ````` ````
if turn_player_win=1
turn_player_win=0
else
if turn_player=1
turn_player=2
else
turn_player=1
endif
endif
anglez#=0
endif
endif
GOSUB keypress:
gosub TURN_PLAYER_COLOR
sync
until TOTAL_SCORE=COUNT/2
`endwhile
final_score_1$="Score speler 1="+str$(SCORE_PLAYER1)
final_score_2$="Score speler 2="+str$(SCORE_PLAYER2)
if SCORE_PLAYER1>SCORE_PLAYER2
winner$="Speler 1 heeft gewonnen!"
else
if SCORE_PLAYER1=SCORE_PLAYER2
winner$="Het is gelijk spel!"
else
winner$="Speler 2 heeft gewonnen!"
endif
endif
`CLS 0
ink rgb(255,255,255),1
set text opaque
repeat
center text screen width()/2,screen height()/2-30,final_score_1$
center text screen width()/2,screen height()/2,final_score_2$
center text screen width()/2,screen height()/2+30, winner$
until spacekey()
undim card()
end
```````````````````````````````````````````````````````````````````````
`-------------------------
REM **kaartkeuze**
kaartkeuze:
cls
dim CARD(COUNT)
for t=1 to COUNT
start:
CARD_CHOISE=rnd(COUNT-1)+1
for r=1 to t
read CARD(r)
if CARD(r)=CARD_CHOISE
goto start
endif
next r
CARD(t)=CARD_CHOISE
next t
return
REM ***LOAD_OBJECT_CARD***
REM ***load 2x24 cards ***
kaartladen:
cards_count=COUNT/2
dim $mem(cards_count)
e=cards_count
for a=1 to cards_count
$mem(a)="models/mem/mem"+str$(a)+".x"
h=a+cards_count
load object $mem(a),a
load object $mem(a),h
hide object a
hide object h
rem rotate_card
`yrotate object a,180
fix object pivot a
` yrotate object h,180
fix object pivot h
set object a,1,1,1,0,0,0,0
set object h,1,1,1,0,0,0,0
`set object texture a,0,1
`set object texture h,0,1
next a
undim $mem(24)
RETURN
rem *************FUNCTONS******************
REM ****TABLE****
function table_wood(bmp$)
load bitmap bmp$,30
get image 100,0,0,256,256
wait 10 :`wait, else error in bmp table
delete bitmap 30
make object box 100,50,10,100
texture object 100,100
`set object texture 100,0,1
position object 100,0,0,5
scale object 100,100,10,100
scale object texture 100,2.5,1.25
yrotate object 100,90
fix object pivot 100
set object 100,1,0,0,1,0,0,0
endfunction
function pakje(pakje$,nummer,px,py,pz,pakjex#,pakjey#,pakjez#,draai#)
load image pakje$,nummer
make object box nummer,px,py,pz
texture object nummer,nummer
scale object texture nummer,1,1
set object texture nummer,0,1
set object nummer,1,1,1,1
yrotate object nummer,wrapvalue(draai#)
position object nummer,pakjex#,pakjey#,pakjez#
endfunction
function shadow()
make object plain 101,2,2
color object 101,rgb(110,110,50)
position object 101,0,-6,0
xrotate object 101,90
fix object pivot 101
ghost object on 101,1
endfunction
function win($load)
load object $load,102
scale object 102, 10, 10, 10
xrotate object 102, 45
fix object pivot 102
position object 102,-1.6,3,-2
hide object 102
endfunction
REM ****KEYPRESS****
keypress:
if rightkey()=0 and keypressR=1
keypressR=0
endif
if leftkey()=0 and keypressL=1
keypressL=0
endif
if downkey()=0 and keypressD=1
keypressD=0
endif
if upkey()=0 and keypressU=1
keypressU=0
endif
if rightkey()
if keypressR=0
keypressR=1
SELECTED_CARD_X=SELECTED_CARD_X+1
if SELECTED_CARD_X>8
SELECTED_CARD_X=1
endif
gosub MOVE_CARDS_SELECT:
endif
endif
if leftkey()
if keypressL=0
keypressL=1
SELECTED_CARD_X=SELECTED_CARD_X-1
if SELECTED_CARD_X<1
SELECTED_CARD_X=8
endif
gosub MOVE_CARDS_SELECT:
endif
endif
if downkey()
if keypressD=0
keypressD=1
SELECTED_CARD_Y=SELECTED_CARD_Y+8
if SELECTED_CARD_Y>40
SELECTED_CARD_Y=0
endif
gosub MOVE_CARDS_SELECT:
endif
endif
if upkey()
if keypressU=0
keypressU=1
SELECTED_CARD_Y=SELECTED_CARD_Y-8
if SELECTED_CARD_Y<0
SELECTED_CARD_Y=40
endif
gosub MOVE_CARDS_SELECT:
endif
endif
RETURN
MOVE_CARDS_SELECT:
SELECTED_CARD_OLD=SELECTED_CARD
SELECTED_CARD=SELECTED_CARD_X+SELECTED_CARD_Y
ox#=object position x(card(SELECTED_CARD))
oy#=1.5
oz#=object position z(card(SELECTED_CARD))
oxo#=object position x(card(SELECTED_CARD_OLD))
oyo#=0.6
ozo#=object position z(card(SELECTED_CARD_OLD))
position object card(SELECTED_CARD),ox#,oy#,oz#
position object card(SELECTED_CARD_OLD),oxo#,oyo#,ozo#
position object 101,ox#,oyo#,oz#
RETURN
TURN_PLAYER_COLOR:
if turn_player=1
ink rgb(255,0,0),rgb(0,0,1)
set text opaque
else
ink rgb(100,100,100),rgb(0,0,1)
set text opaque
endif
text 0,0,"SPELER 1: "+str$(SCORE_PLAYER1)
if turn_player=2
ink rgb(255,0,0),rgb(0,0,1)
set text opaque
else
ink rgb(100,100,100),rgb(0,0,1)
set text opaque
endif
text SCREENWIDTH,0,player2$
set text opaque
RETURN
movecamera:
if turn_player=1
movecam#=+0.25
else
movecam#=-0.25
endif
for zxc=1 to 10
`repeat
xcam#=camera position x()+movecam#
position camera xcam#,camera position y(),camera position z()
point camera -1.25,0,-1.25
sync
next n
`until (camera position x()<=(camera position x()-10)) or (camera position x()>=(camera position x()+10))
return
load_start_game:
dim gamecard(2)
cardstart=0
score_player1=0
score_player2=0
TOTAL_SCORE=0
game_end=0
load music "music/Strooiavond.mid",1
loop music 1
GOSUB start_game:
RETURN
The text is in dutch.
try to make your own exe.
card 24 is in my dbTemp map (only that one?).
i like to hear if it is oke.
(bought dbc 15 years? ago and never made a finished program. so i want to finish something with it. else it had to lay on the shelf for nothing. i do this for fun, not for selling games in the future.)
Now i go to bed. lol.
Other amateurs have fun with it!
Greetings!
Toedeledoki