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.

2D All the way! / can any one help me make a jump command for my super mario?

Author
Message
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 3rd Mar 2004 15:06
Im getting clever, but still need help, I have mario now moving left and right, and made a small platform, i need him to jump now, any ideas? also can anyone help me to make a scroll command so when his near the end of the screen it will scroll? I have inserted some coins in my game, and made him collect the coins, so if any one knows how 2 do a score command that will also be great! it's slowly working and taking time, any one also, lol, knows how to put loads of coins sprites on the screen rather than keep doing this, will help.

load image "coinss.bmp",16
abv=16
sprite 11,y60,x20,abv
offset sprite 11,-200,-720

thanks alot,
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 3rd Mar 2004 15:17
load image "coinss.bmp",16
abv=16
coinno=11
coinamount=10
x=100
y=200

for n=1 to coinamount
sprite coinno,x,y,abv
coinno=coinno+1
x=x+32
next n

GIve me more power!
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 3rd Mar 2004 15:22
That will put 10 coins on screen in a row. You can have any amount of sprites(I think the maximum is 64,000 in DBC, but unlimited in DBpro) with the same image(in this case 16). To do a score is easy, just say

score=0
coinvalue=10

if sprite col(mario,coin) then score=score+coinvalue
set cursor 300,50
print score

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 3rd Mar 2004 15:30
cheers mate you are well cool, i will check it out!
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Mar 2004 15:50
Yeah you could use print score, or you could draw images of 1,2,3,4,5,6,7,8,9,0 and use them as sprites, or plains, or just paste them. I was going to show you my source code, but it uses plains, and it also does this....000150, it adds the extra zeros to the beginning. Most people don't do that, so I didn't bother posting it.

Pincho.

smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 3rd Mar 2004 21:41
any ideas on how 2 make the bloody sprite jump, he can only walk left and right, lol.
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Mar 2004 23:07
I just posted a mario jump code, it's in the Trigonometry thread below. I found it in the code base.

smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 4th Mar 2004 12:07
hi i really want help on a jumping code, for example:

load image "up1.bmp",19
bbe=18
sprite 18,100,100,bbe

do


if upkey()=1
y=y+0
y=y-walk

if bbe<18 or bbe>18
bbe=18
endif
rundir=1
endif

sync
loop


how can i get him 2 jump, and load him 2 go up the screen, cos everytime i press up key, i get the coinss.bmp going up, i want him to walk up and jump, whne i press the space bar...any ideas?

thanks
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 4th Mar 2004 12:51
Ok, you need to use sine. This is a bit of trigonometry, that if you feed in an angle, it gives you a length of a side on your triangle. HOwever, it feeds you with a list of numbers that you can whack into a variable, and add this onto your y position. Youll have to read a bit of trig, but its not hard. Its just confusing. Anyway, the number sequence you get has interesting properties, in that it goes up in value then down in value, just like the Y position of mario. So, when you press jump, you want to generate the first number in your sine wave and use that to place the y postion of Mario. There is an exammple in one of the dark basic turorials that I have, Ill post it up. Basically, it plots a circle on screen using sine and cosine, but if you take out the cosine it just draws a dot on screen going up and down....

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 4th Mar 2004 15:56
please can you post it?
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 4th Mar 2004 16:37
Im at work now so Ill do it when I get home...

There are some good Trigonometry tutorials on the internet, easy to find with google.

GIve me more power!
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 4th Mar 2004 17:26 Edited at: 4th Mar 2004 17:28
paste this in your code and it should work
replace mario with the sprite number and height
with how high he should jump


if spacekey()=1 and jump=0
jump=1
start_y=sprite y(mario)
jump_angle=0
endif

if jump=1
inc jump_angle,1
final_y=start_y + (sin(jump_angle) * height)

if jump_angle=90 or sprite collision(mario,platforms)=1
jump=0
endif
endif

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 4th Mar 2004 18:17
see the use of the sin command? Thats what Im talking about! sin is the abreviation of sine, cos is cosine and tan is tangent. The opposites are asin, acos and atan.

Thanks for the code Baal

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 4th Mar 2004 21:43
yeah cheers 4 that, i will check it and let you know, thanks.
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 4th Mar 2004 21:53
basically this is a crap code, but im learning and I know it's crap, but can any 1 tell me how 2 get him 2 jump from this code, and put a platform on, i have managed him 2 collect coins now, i still cant get him to jump, walk and scroll, and put a bitmap behind, any help at all would be great.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 4th Mar 2004 22:14
haha, you forgot to edit my code completely.

Look for " * height )"

you'll have to change it too.

Make it " * 20 )"

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 12:15
ok cheers i try and let you know,
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 12:21
ive tried it but nothing happens, can u write the code out 4 me the way it should be, my mario sprite is number 1, please could you do that?
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 12:34
for some reason i can not get it 2 work
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 5th Mar 2004 13:09
height=50
x=200
marioy=300
imagenumber=1


do
sprite 1,x,marioy,imagenumber

if spacekey()=1 and jump=0
jump=1
start_y=marioy
jump_angle=0
endif

if jump=1
jump_angle=jump_angle+1
marioy=start_y+ (sin(jump_angle) * height)

if jump_angle=90 or sprite collision(mario,platforms)=1
jump=0
endif
endif

loop

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 13:22
cheers i try and check this out and let you know if it works, i hope it does.
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 13:30
it aint working,,,, help help help,
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 13:33
its saying ERROR :- sprite number must be greater than zero at line 291
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 5th Mar 2004 13:54
OK, try just running the jump code on its own, and I think its returning a value of 0 for the mario collision check,checking to see if there is a collision with sprite(mario). As there is no variable for what mario is then there is no sprite for it to check. It assumes the variable "mario" is 0, and you cant have a sprite that has the number 0. Anyway, as I say, just try the code I gave you, but remove the collision detection line, and run it seperately from your other code to see if it works, THEN if it works ok, put it into your game...

I always do it that way, get your code working in as simple way as possible, test each routine on its own, then stick it all together. Im working on a top down/turn based war game at the moment and have written the code to put down "waypoints", the code to select different units, the code to point the units in the correct direction and move them and the code to go to the next turn phase. Now all I have to do is stick it all together(about 1 or 2 days worth of fiddling about with all the numbers untill it works!)

Anyway, I now have the code to make a homing missile if anyone wants it. Its basically code that uses trigonometry to move and rotate a sprite to a specified point, but it updates itself every time the game loops, which is funny!

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 14:12
yeah i have the code m8, im thanking you for your time helping, i really do appreiciate it, cheers all.
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 5th Mar 2004 14:21
It can seem really bewildering trying to learn to program, but a computer is a stupid machine, and you are a human being, so it is possible for you to do anything you want with the machine. Its just a matter of working out how to talk to it!

GIve me more power!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 5th Mar 2004 14:41
ive tried doing this jump thing, but nothings happening, any other possible ways? if u can write the code out would be cool, cos at the moment i aint that clever at it. cheers.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 5th Mar 2004 20:18 Edited at: 5th Mar 2004 20:19
ok, last try:



rem variables, CHANGE THESE NUMBERS!!!
Mario_sprite = 1
Mario_x = 300
Mario_y = 300
Mario_image = 1
Platform = 10
Jump_height = 20
Jump_angle = 0
Jump_speed = 1
jump = 0

rem In your DO SYNC LOOP

if spacekey()=1 and jump=0
jump=1
jump_angle=0
mario_starty = sprite y(mario)
endif

if jump=1
jump_angle = jump_angle + jump_speed
mario_y = mario_starty + sin(jump_angle)*jump_height
if jump_angle=90 or sprite collision(mario,platform)=1 then jump=0
endif

sprite mario,mario_x,mario_y,mario_image

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 6th Mar 2004 02:10
ok i try cheers and let u know the out come
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 6th Mar 2004 12:25
i cant't get it 2 work, any1 who wants the code and the media files, please let me know and see what you can do 4 me, see if u can see what im doing wrong, I appriciate any whos helping me out, and if you really help me make this game, i will offer them something special, and i mean special!!!

cheers
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 9th Mar 2004 09:04
Allright, smokeogizmo world. I needed a jump code for the game I am making, so I will share it with you. I don't know what these guys are talking about thinking you can only use the sin command.

In everything I've tried you need both sine and cosine to create a curve. Anyway, enough rambling Here's the code.


If this doesn't work for you, I don't know what will!
smokeogizmo world
21
Years of Service
User Offline
Joined: 28th Feb 2004
Location: kent
Posted: 13th Mar 2004 20:44
cheers mate i try it out and let you know

Login to post a reply

Server time is: 2025-08-09 02:12:09
Your offset time is: 2025-08-09 02:12:09