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.

Dark GDK / Not Equal to

Author
Message
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 22nd Jul 2008 18:52
Alright. Im trying to make my first Dark DGK game in 2d so that I can firm up on the basics. However, the basics are giving me some trouble. Here is my whole source code.



heres the problem. For testing purposes, I want the player ship (sprite one) and the enemy ship (sprite two) to be invinsible. So when I do all the shot collision detection, its somthing like this.


When I go to test it, The shots still blow up the player and the enemy.
So my question is, why did that happen. I clearly coded that (in english)

if col doesnt equal 1 or 2
delete sprite col
endif

but it doesnt seem to do pay any attention to the doesnt equal to?


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 22nd Jul 2008 19:18 Edited at: 22nd Jul 2008 19:18

You should enclose individual if-statement conditions using parentheses, and the entire set of conditions if there are more than one.


My site, for various stuff that I make.
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 22nd Jul 2008 19:40
hmm. Even with that bit, it still doesnt work. The player ship, and the enemy ship still get deleted.


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Jul 2008 19:45
The condition doesn't make sense. You're saying if col isn't 1 or 2, then be true. But if it's 1 it can't be 2, and if it's 2 it can't be 1. Therefore the condition will always be true.

flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 22nd Jul 2008 19:58 Edited at: 22nd Jul 2008 20:01
hmm.
col can be anything from 1 to 400.
I want to single out 1 and 2.
I could do that two ways I guess.

1- only if col is >2
2- only if col is not equal to 1 or 2

So the condition makes sense, but i know why Benjamin said what he said. col will always come out to be 1 OR 2 because when the shots spawn, they spawn on sprites 1 and 2.

Ill go try and get that to work. Thanks for the help guys.

EDIT:
hmm. When I move sprites 1 and 2 out of the way, not only does it lag like a snail, but the sprite 2 also gets toast.
Sorry to be so whiny, but I really dont get why its doing this.


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 23rd Jul 2008 01:55
It sounds more like you want the AND, not OR. Two ampersands instead of the bars.


My site, for various stuff that I make.

Login to post a reply

Server time is: 2024-11-17 20:52:09
Your offset time is: 2024-11-17 20:52:09