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.

Newcomers DBPro Corner / 2D Sprites Help

Author
Message
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 11th Nov 2003 23:08
i'm trying to make a character walk (but it'd be like the background is moving but he animates) and i want him to be able to pick up other sprites i put there...

i'm pretty sure how to make the first sprite (the character) but what would be the code to make a background move behind him(i'm making it so he constantly walks, so how would i make the background constantly moving?), and what would be a code for it to recognize him picking the thing up?

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 11th Nov 2003 23:16
i use DBC by the way

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 12th Nov 2003 00:35
!bump!

You did what? For who?! For how many jellybeans?!?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Nov 2003 00:40
Bump? It's only been just over an hour

Anyway, why not just look at CodeBase?

http://darkbasicpro.thegamecreators.com/?m=codebase_view&i=dc2f1b35292009ad54b84331daee10ef
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 12th Nov 2003 00:59
is that supposed to run without me changing some things? it has syntax errors when trying to compile it, mabey things have to be changed? plz tellme IanM

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 12th Nov 2003 03:06
i tired to run ur code IanM but it came with errors, but it didnt work, do i have to fill something out? anyone please post a fully working code for DBC please, not DBP, but DBC

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 12th Nov 2003 03:29
i'd rrrreaaly like an answer today, its 8:30...

You did what? For who?! For how many jellybeans?!?

blank
21
Years of Service
User Offline
Joined: 4th Mar 2003
Location: My Computer
Posted: 12th Nov 2003 12:46
Hey, this might work but dont get your opes up, try making the background a sprite,
Hope this helps, Cartoon Monkey
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Nov 2003 14:53
I'll try and find the conversion I did a while back and post it this evening for you
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 12th Nov 2003 23:24
ok, thnaks, get that code here soon, and i dont think ur code worked very well cartoon monkey

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 13th Nov 2003 01:31
well, it's evening, and still no code... i'll wait longer... i guess... but i really want this code, becuase i want to get something done, and until i have it to build on, i'm deadlocked on the game.

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 00:43
well, i got a pretty good idea of how to do my first queston, now i have a new one. How can i make it so an sprite randomly comes onto the screen and if one sprite runs over the other sprite it will add score to the total score, would this be Sprite Collision? if it is just give me an example of how to make them randomly appear... i guess the for I= 1 to 10 thing.. and next I, i'll try but reply anyway

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 01:06
ummm... i think i would know how to do it all but, heres code i use to get my sprites on the screen that the guy can pick up



but this seems to go realllllyyyy fast, and i want like 2 or 3 on the screen at the same time, not all 100, and how would i make it so the sprite moves at the speed of the background which is x=x-5
thnx in advance

You did what? For who?! For how many jellybeans?!?

UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 14th Nov 2003 03:14
you do realize using a for next command your literally asking to place all 100 on the screen at the same time right? maybe you should do this

for I=1 to 3
Sprite (I),rnd(640),rnd(400),11
Next I

http://www.freewebs.com/ingamers
load image "sp1.bmp",1
paste???? 2d games = fun....teach me
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 03:23
yes, i noticed, but still putting 3 on there doesnt do anythign, what i want to know, is how to make them move across the screen? and how would i make like 100 total move across the screen, btu not at the same time??? this is what i need to know

You did what? For who?! For how many jellybeans?!?

UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 14th Nov 2003 03:25
ohh i c you need to code AI then to tell them where to move and when ect..

http://www.freewebs.com/ingamers
load image "sp1.bmp",1
paste???? 2d games = fun....teach me
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 03:27
if i knew how to make AI of course....

You did what? For who?! For how many jellybeans?!?

Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 05:13
Anyone wanna give me a code that will randomly place sprites on a map and have sprite collision with those so when he collides something happens, and all the randomly placed sprites will keep appearing and move along with the background which moves at "x=x-5" anyeonw anna gimme code for this? and example? mods? anyone?
if i need to resort to AI, then please post AI code here too, to do what i explained, thanks all

You did what? For who?! For how many jellybeans?!?

the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 14th Nov 2003 12:07
You need player image, make it no 1, and an enemy image, no 2.
You need is a method to keep track of sprite numbers.
something like
Make the player sprite 1
make the enimy sprites 10,11,12,13 etc.

Work out what you want to trigger removing a sprite.
when the player sprite hits it for instance or if it goes off screen
for i = 10 to 13
if sprite x(i) < -10
delete sprite i
else
if sprite collision(1,i)
delete sprite i
endif
next i

Work out what you want to trigger a new sprite appearing.
Something like when all sprites are not onscreen.
for i = 10 to 13
if sprite exist(i) =0
sprite i,rnd(screen width()),rnd(screen height()),2
endif
next i

Work out how you wan the sprites to move.
for i = 10 to 13
if sprite exist(i)
sprite i,(sprite x(i)-5),sprite y(i),sprite image(i)
endif
next i

work out how you want the player to move.

Keep building up in small stages until it works as you want.
I wrote the code directly into the box so some syntax might be a bit off and my spelling is bad today.

I would have posted full sorce but I think you would just copy/paste and not read and understand it and then get stuck at with anything more advanced.

dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard
Newbie Brogo
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: In a Pool of Cats
Posted: 14th Nov 2003 23:24 Edited at: 15th Nov 2003 00:00
well. i tired some of your code, i understand it all but can you please post an example? i tried to use it and every single line was syntax, and nesting errors, and i'm a little confused on the first line, but if you could just post code, i can put it together with your explainin above and understand it fine...

You did what? For who?! For how many jellybeans?!?

the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 15th Nov 2003 10:06


dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard

Login to post a reply

Server time is: 2024-11-25 17:37:09
Your offset time is: 2024-11-25 17:37:09