Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
adawginthefog
User Offline
Joined: 17th Jan 2017
Location:
Posted: 23rd Feb 2017 16:17
I am trying to modify the jump game to a game for fat burning. If you get far enough in my game a pear comes down and if you collect it, you jump higher. The object number for that object is 5851. I am trying to create more objects just like that but different looks on them. I am also trying to make more come as well. If anyone knows what I mean could you please try to help? Thanks

//By Matija https://forum.thegamecreators.com/thread/188248


set display mode 800,600,32
sync on
sync rate 60
autocam off
hide mouse
set ambient light 35
color backdrop 0

OptionSection:
cls 0
load image "picture/titlepage.bmp", 781
ink rgb(0,0,0),0 : set text font "arial" : set text size 14 : set text to bold : set text transparent

do
REM SCREEN DISPLAY
REM CONTROL INPUT
paste image 781, 0, 0
if Keystate(scancode())=1 then gosub MainSection
REM REFRESH SCREEN
sync
loop

MainSection:
load image "picture/road.bmp",86
load sound "sound/loop.wav",94 : set sound volume 94, 75
load image "picture/jim.bmp",96
load image "picture/peartexture.bmp",82

PlayGame:
score = 0
gameover = 0
speed# = 0
speedy# = -10
dim platforms(20)
JumpBonusTimer# = rnd(500)+200
stepy = 0
stepx = 0
loop sound 94
make object box 1,30,5,10
position object 1,0,0,500
color object 1,rgb(255,255,0)
load object "object/dude.x",5850
scale object 5850,1000,1000,1000
rotate object 5850,0,90,0
texture object 5850,96
load object "object/pear.x",5851
texture object 5851, 82
scale object 5851, 1000,1000,1000
position object 5851,rnd(900)-450,400,500
make object box 5824,3000,2000,1000
position object 5824,0,0,2000
texture object 5824,86


for x = 2 to array count(platforms()) rem
make object box x,50,10,20
color object x,rgb(rnd(100)+100,rnd(100)+100,rnd(100)+100)
position object x,stepx,rnd(20)-50+stepy,500
inc stepy,50
stepx = rnd(720)-360
next x

do
scroll object texture 5824, 0, 0,-.003
set text size 26
set text font "impact"

ink rgb(217,224,21),0
center text 400,15,"Fat Burned: "+str$(score)
if object position y(1) => 50 and speedy# <= 0
for x = 2 to array count(platforms())
move object down x,speedy#*-0.8 rem stair speed
next x
move object down 1,speedy#*-0.8

if JumpBonusTimer# <= 0
move object down 5851,speedy#*-0.8
endif

endif

inc speedy#,0.2
if speedy# => 10 then speedy# = 10
speed# = speed#*0.93
move object down 1,speedy#
move object left 1,speed#
if leftkey() = 1
inc speed#,0.5
endif
if rightkey() = 1
dec speed#,0.5
endif

for x = 2 to array count(platforms())
if object collision (1,x) and speedy# => 0
speedy# = -7
endif
next x

position object 5850,object position x(1),object position y(1)+25,object position z(1)
if object position x(1) > 380
position object 1,380,object position y(1),500
endif
if object position x(1) < -380
position object 1,-380,object position y(1),500
endif
if object position x(5850) > 380
position object 5850,380,object position y(5850),500
endif
if object position x(5850) < -380
position object 5850,-380,object position y(5850),500
endif

for x = 2 to array count(platforms())
move object down x,1
if gameover = 0
if object position y(x) < -320
inc score,1
position object x,stepx,400,object position z(x)
endif
endif
stepx = rnd(720)-360
next x
if gameover = 0

endif
dec JumpBonusTimer#,0.35
if JumpBonusTimer# <= 0
move object down 5851,2
endif

if object collision (5850,5851)
speedy# = -20
position object 5851,0,-500,0
endif
if object position y(5851) < -320
JumpBonusTimer# = rnd(500)+200
position object 5851,rnd(900)-450,400,500
endif

if spacekey() = 1
JumpBonusTimer# = rnd(500)+200
score = 0
gameover = 0
speed# = 0
speedy# = -10
stepy = 0
stepx = 0
position object 1,0,0,500
position object 5850,object position x(1),object position y(1)+25,object position z(1)
for x = 2 to array count (platforms())
position object x,stepx,rnd(20)-50+stepy,500
inc stepy,50
stepx = rnd(720)-360
next x
position object 5851,rnd(900)-450,400,500
wait 50

endif

if object position y(1) =< -350 then gameover = 1

if gameover = 1
for x = 2 to array count(platforms())
move object down x,5
stop sound 94
next x
if JumpBonusTimer# <= 0
move object down 5851,5
if object position y(5851) < -320
JumpBonusTimer# = 999999999999
endif
else
JumpBonusTimer# = 999999999999
endif
endif
sync
loop
EndSection:



Attachments

Login to view attachments
zero32
User Offline
Joined: 28th Jul 2016
Location:
Posted: 23rd Feb 2017 19:53
first, if you post code, please put it inside of a code tag.
second, you need to upload a zip file containing your images and sounds. i edited the code so i can compile it anyway but don't count on anyone else to do it. the dbpro file on it's own does not help.

now to your problem:
soooooo you want the jump game with different powerups, or what? if that's the case:

around line 134 there is this:
+ Code Snippet
this checks if the player collides with the pear. speedy# controlls the jump height. everything below 0 will make the player go up, everything above 0 will make the player fall. then the pear will be positioned to somewhere below the player to trigger the reset code:
+ Code Snippet

if you want different items to appear, you could load each object, position it at random like the pear in your code and then, if the JumpBonusTimer# is <= 0 select a random item and only move the selected item down.
i would suggest saving the object nr to a variable and use the variable to move the pear. also change the object nr of the pear to, let's say 6000 (to make it less cryptic), the next item would then get object nr 6001 and so on. if you had 5 items, you would just need to call rnd(5)+6000 to get the object nr of a random item.
smerf
12
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Feb 2017 00:11
adawginthefog please put code in code tags also why are you posting under two names xxaxedentalxx?
A child's dream never dies.





Login to post a reply

Server time is: 2017-07-20 21:36:12
Your offset time is: 2017-07-20 21:36:12