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.

Author
Message
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 13th Oct 2005 22:42
Hi everybody!

Once again I'm back to work on the masterpiece "Pin-Go," a pong clone with breakout style action. I'm attempting to add powerups (e.g long paddle) but it's not working quite right.

I have 2 variables, 1 to determine if player1 should get the powerup, and one to determine when the other player gets one. The variables switch back and forth whenever the paddle hits the ball. (So if you hit the ball, you get the powerup) But it's always detecting the computer player as getting the powerup.

Here's the basic bouncing code:


It looks like it should work. The code for the entire game is in the source box. (it's non media so just plug it into DBPro and play)

"I will work harder... if you ask me enough times."
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 13th Oct 2005 23:27
You got some floats there that have boolean tests on them. Using floats and comparing with '=' operator is gonna lead to problems.
Lose the # from the end of any variable that doesn't need to be a float.
eg:
bosslvl#,player1hit# and player2hit# should be bosslvl,player1hit and player2hit.

Don't know if this is cause of this particular problem but if you continue to use floats and the '=' (for comparison not assignments obviously) you will get problems.

Or instead of if variableabc#=5, use if int(variableabc#)=5.


The word "Gullible" cannot be found in any English Dictionary.
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 13th Oct 2005 23:48 Edited at: 13th Oct 2005 23:57
O! I didn't know that affected it. I always thought that the # meant it was a variable. Just like $ is for string.


Edit: Ok, I tested out removing the #s from the end of the variables to make them not be floats, but nothing seems to have changed.

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 14th Oct 2005 18:57 Edited at: 14th Oct 2005 19:45
I've decided to define all my variables at the beginning of my program.

So the stupidist question I can ask right now is.... How do you define a boolean variable.


Edit: Nevermind that. Here's the most recent code. The detection of hits still doesn't appear to work.



"I will work harder... if you ask me enough times."
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 15th Oct 2005 00:24
Well just about defining booleans in DBP I'll go over anyway so other newcomers can figure it out.

A boolean is a true/false variable. By giving it true or false you can check for certain changes such as an object not rotating. In DBP (as far as I know) there are technically no booleans. An integer will work as a boolean you just give it the values 0 and 1 instead of true and false.

I R tEh Antid0te! ROOOAAAR!
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 15th Oct 2005 06:08
Can't you just :

Dim boolean monkey

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 15th Oct 2005 08:03
Anyway, another newb question. I really should know all of this, I've just forgotton it one way or another.

How do you load an image, texture it on a plain, and then make sure that plain is in the background.

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 18th Oct 2005 12:59
Anybody?

"I will work harder... if you ask me enough times."
Evil stick
19
Years of Service
User Offline
Joined: 27th Mar 2005
Location:
Posted: 18th Oct 2005 14:02
Well, I'm not sure, but what's the point of a boolean? I know what they do, but what's the point?

I ALWAYS have flame proof jacket...just in case...and a shotgun. If you want any, just ask!

We are all nice,except for that one who's name starts in a m and ends in erranvo.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 18th Oct 2005 18:53
@Programmer of Power
Load image "file directory and name" , imagenumber
make object plain objnum , xsize , ysize
texture object objnum , imagenumber

The position the plain towards the back and make sure it moves with the camera. If your doing a 2d game it's really easy. If your doing a 3d game I suggest using backdrop off , draw sprite to back , then load the image and make a sprite in the backround. That will always appear in the back.

@Evil stick
Think about it this way. How many times when programming in DB have you had to get a value such as upkey(). When you call the upkey the program is checking a boolean if it is pressed or not. If you could not return values in this way then it would be impossible to get any keyboard , mouse , joystick , or internal system data.

Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 19th Oct 2005 13:18
I was messing around with all of this, this morning, and I couldn't seem to get it to work either way.

This picture I'm using is currenty only for the menu of the game, but the game itself is 3d.

Since the program is mostly 3d, I tried using the draw sprite to back command, but it didn't seem to work, only the "sprite" part of the command was accepted as a command, so um.... I don't really know how to fix it.

And the 2d version of making a plain and putting it in the back didn't show anything. I made sure that all the cls's were out of the way and such but still nothing.

"I will work harder... if you ask me enough times."
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 19th Oct 2005 15:47
Why don't you post some code for us to look at?

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
http://dbworlds.darkuniverse.net/
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 19th Oct 2005 21:42
Um, if you'd read some of the above posts you can see the code, however I'll post the newest code in this post.

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 20th Oct 2005 12:54
In that code one problem that I'm trying to fix is here.


When I run the program, player2hit is always 1 and player1 hit is always 0.

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 20th Oct 2005 13:08
Anyway, back to the image thing. I got the image to come up, but it won't go away, I've tried using hide sprite and hide object but neither have worked, I just get some half-demeted arena with the picture overlaying it.

And the picture only shows when I use the debug feature, just making a compiled version doesn't show the picture.

"I will work harder... if you ask me enough times."
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 21st Oct 2005 00:52
Is there something that changes between the debugger and the actual program. I press F5 and it loads a game without some of my big fixes for collision and no picture at the menu. When I use the debugger, I have a picture that shows up on the menu but then won't go away with the cls! ugh.

"I will work harder... if you ask me enough times."

Login to post a reply

Server time is: 2024-11-27 14:35:30
Your offset time is: 2024-11-27 14:35:30