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 / can someone plz help wit my 2d animation!!!!!!!

Author
Message
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 5th Nov 2004 20:39
right now im just tryin to get megaman to switch to a shooting image and shoot a ball when i press the enter key. but when i do so i can only shoot the ball once and theres 2 sprites on the screen!
plz help. Im only 13 for cryin out loud!



sync on

x= 320
y= 240



shoot()

end

function shoot()

load image "megamanstill.bmp", 1

load image "megamanshootingwoball.bmp", 2

load image "megamanshot.bmp", 3

hide mouse

x= 320
y= 240
x1= 358
xshot= x1

do

sprite 1,x,y,1

if x> 600
x= 600
endif

if x< 0
x= 0
endif

if returnkey()= 1
sprite 2,x,y,2
sprite 3,xshot,250,3
for xshot= x to 640
next xshot
else
cls
sprite 1,x,y,1
endif

if rightkey()= 1
x= x+5
x1= x1+5
else
sprite 1,x,y,1
endif

if leftkey()= 1
x= x-5
x1= x1-5
else
sprite 1,x,y,1
endif
sync
loop
endfunction
Dodo
19
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 6th Nov 2004 02:37


here is your code tidied and(hopefully) working. However, if you want to have a sprite of someone shooting then I suggest using an animated sprite, which you can make in DB using the "make animated sprite" command.

Quote: " Im only 13 for cryin out loud!
"


lol! me too

Part of solving the problem is actually noticing that the problem is there in the first place

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 02:45
thanks ill try it. and are you really 13 becuase i am?
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 03:00
the code u gave me did stop the sprites from duplicating but the enter key would only work once.
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 03:20
your code also made everything blink alot. thats ok though. im sure someone else know how to fix my code. thanks for your time!
Dodo
19
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 6th Nov 2004 04:42
Quote: "the code u gave me did stop the sprites from duplicating but the enter key would only work once. "


ok, I fixed that, now justneed to work out where the flickering came from. If you posted youre images then I might be able to try it for myself. lol



Quote: "and are you really 13 becuase i am? "


yes, I am 13.

Part of solving the problem is actually noticing that the problem is there in the first place

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 05:40
sry but that works even worse. but here are the one of the pics I use. u can download it.

Attachments

Login to view attachments
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 05:41
heres pic 2.

Attachments

Login to view attachments
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 05:41
heres pic 3.

Attachments

Login to view attachments
Dodo
19
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 6th Nov 2004 05:58
ok, this code works fine for me should work for you too



Part of solving the problem is actually noticing that the problem is there in the first place

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 06:24
wow that works great but theres still some things that need to be worked on and if you could help me that would be great. 1) the flickering of the sprite. 2) the shooting of the ball.
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 07:02
k i fixed the flickery sprite thing.

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 6th Nov 2004 23:45
heres some better code. k.


kkzgreen
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location: Nashville, TN
Posted: 7th Nov 2004 23:03
hey im 13 to

anyways I dont know if u've noticed that whenever u pres ENTER the ball keeps on going from the last coordinates*(when u released enter)

i gotta go to church right know but i think that i can fix that.
kkzgreen
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location: Nashville, TN
Posted: 8th Nov 2004 03:54


This is the code i got.
I still have to correct the fact that u cant c megaman shooting
Dodo
19
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 8th Nov 2004 04:10


here is working code with no flashing and the bullet shooting correctly. lol.

Part of solving the problem is actually noticing that the problem is there in the first place

kkzgreen
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location: Nashville, TN
Posted: 8th Nov 2004 06:27
TO cool dude programmer

So do u think u can give me some good links for a DBZ game?
kkzgreen
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location: Nashville, TN
Posted: 8th Nov 2004 08:22
TO cool dude programmer

Since ur doin a Megaman game u might want to use this

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 9th Nov 2004 05:48
thanks dude
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 10th Nov 2004 21:11
sorry dude i'll find some goku sprites fight away. ive been sorta busy lately.
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 11th Nov 2004 09:08
i cant find any dbz sprites. sry. but i'll keep looking.
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 12th Nov 2004 21:36
im makin some progress in my game in my other thread here http://forum.thegamecreators.com/?m=forum_view&t=42211&b=4. i just didnt want to bother postin all that stuff in this thread.
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 15th Nov 2004 06:51
hey heres some better code for anybody who wants to help me with it. I'll post the new images soon.


[/code]

sync on
sync rate 60

`hide mouse
hide mouse

`define variables
x= 320
y= 240
x1= 358
xshot= x1+10
bulletlife= 0

`load images
load image "megamanstill.bmp", 1
load image "megamanshootingwoball.bmp", 2
load image "megamanshot.bmp", 3
load image "megamanrun1.bmp", 4
load image "megamanrun2.bmp", 5
load image "megamanrun3.bmp", 6
load image "megamanrun4.bmp", 7
load image "megamanrunshoot1.bmp", 8
load image "megamanrunshoot2.bmp", 9
load image "megamanrunshoot3.bmp", 10

`the main loop
do

`ensure sprite doesn't go off screen
if x>600 then x=600
if x<0 then x=0

`move left
if leftkey()= 1
dec x,5
dec x1,5
else
sprite 1,x,y,1
endif

`move right
if rightkey()= 1

if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then show sprite 4
sprite 4,x,y,4
wait 150

if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif

repeat
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then show sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 5,x,y,5
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then show sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 6,x,y,6
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then show sprite 7
sprite 7,x,y,7
inc x,15
inc x1,15
wait 150
until rightkey()= 0
else
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 1,x,y,1
endif

`shoot
if returnkey()= 1
goto shoot
endif

if rightkey()= 1 and returnkey()= 1
goto runshoot
endif


`the shooting part
shoot:

if returnkey()= 1 and bulletlife<= 0
hide sprite 1
if sprite exist(2)= 1 then show sprite 2
sprite 2,x,y,2
xshot=x1+10
wait 200
bulletlife=60
else
if sprite exist(2)= 1 then hide sprite 2
if sprite exist(1)=1 then show sprite 1
sprite 1,x,y,1
endif

`draw bullet
if bulletlife<=0
if sprite exist(3)=1 then hide sprite 3
else
if sprite exist(3)=1 then show sprite 3
sprite 3,xshot,250,3
inc xshot,5
dec bulletlife
endif

runshoot:

if rightkey()= 1 and returnkey()= 1 and bulletlife<=0
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then show sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 4,x,y,4
wait 150
repeat
if x>600
x= 600
endif
xshot=x1+10
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then show sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 8,x,y,8
wait 200
bulletlife=60
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then show sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 9,x,y,9
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then show sprite 10
sprite 10,x,y,10
inc x,15
inc x1,15
wait 150
until rightkey()= 0
else
if sprite exist(1)= 1 then show sprite 1
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 1,x,y,1
endif

`draw bullet
if bulletlife<=0
if sprite exist(3)=1 then hide sprite 3
else
if sprite exist(3)=1 then show sprite 3
sprite 3,xshot,250,3
inc xshot,5
dec bulletlife
endif

`end loop
sync
loop


[code]
Jonesy
19
Years of Service
User Offline
Joined: 9th Nov 2004
Location: England
Posted: 16th Nov 2004 00:11
I'm havin some trouble getting one sprite to disapear when another sprite appears in its place, i.e. when shooting a gun.
can anyone see what i'm doing wrong? thanks for any help!

`shoot
if spacekey()= 1
hide sprite 1
if sprite exist(2)= 1 then show sprite 2
sprite 2,x,y,2

else
if sprite exist(2)= 1 then hide sprite 2
if sprite exist(1)=1 then show sprite 1
sprite 1,x,y,1
endif

C:\Dos
C:\Dos Run
Run Dos Run
Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 16th Nov 2004 01:38
try:

Qwisats Haderach
19
Years of Service
User Offline
Joined: 23rd May 2004
Location: Dune
Posted: 17th Nov 2004 23:30
did that help?

Login to post a reply

Server time is: 2024-04-19 16:28:21
Your offset time is: 2024-04-19 16:28:21