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! / sprite not moving

Author
Message
theevenflow
20
Years of Service
User Offline
Joined: 23rd Apr 2003
Location:
Posted: 24th Apr 2003 04:33
As a first project to help myself get acquainted with DB, I've decided on a Space invaders type game. Oh so original, I know. Anyhow, the function below is used to create and fire a single bullet. The first bullet created works fine. It moves on up the screen nice and smooth and is deleted when it goes too far (I haven't started in on the collisions yet). However, when you fire another bullet, it just sticks to where it was created. When you press the spacekey again, another one is made and the other sticky one is deleted. This, of course, goes against what is written. If you know what's wrong, please reply. I assume it's something incredibly simple and I'm just to sleepy to figure it out.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 24th Apr 2003 05:49
I made this test program and your function works fine in it. try it out and tell me what happens.

CTP

theevenflow
20
Years of Service
User Offline
Joined: 23rd Apr 2003
Location:
Posted: 24th Apr 2003 17:18
Exact same thing. The bullet fires once just fine, but when you fire another, it just sticks to where it was created.

theevenflow
20
Years of Service
User Offline
Joined: 23rd Apr 2003
Location:
Posted: 24th Apr 2003 17:34
I've solved the problem...rather illogically. Since the sprite was obviously deleting itself after you pressed spacekey and then creating a new one (apparent by the sticky bullet), I just got rid of the delete portion all together and had the program create another sprite if the bullet's y was <= 0. For some reason it works. Could this be a bug? You said your code worked fine...are you using DBP maybe? I'm on DBC.

Hopefully this fix doesn't have adverse effects, but it'll have to be used for now, I guess.

CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 25th Apr 2003 01:33
yes i am using pro maybe it is a bug in classic

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Apr 2003 02:13
I had the same problem with Classic using your code - it looks like the SPRITE EXIST function doesn't notice when you DELETE SPRITE!

I worked around the problem instead - code attached. Please excuse the boxes

Login to post a reply

Server time is: 2024-03-29 02:02:05
Your offset time is: 2024-03-29 02:02:05