Hello,
I am trying to rewrite an old DIV game of mine for windows in BennuGD.
It was a simple game in witch rocks fell from the sky and you had to shoot them to survive.
This time I would like to ad some extra's and one of them is keeping me problems at the moment.
The rocks don't fall straight down, but do this in a random angle, and the also have random speeds.
This means the rocks can hit each other.
In the original game the rocks would fly behind or in front of each other without hitting.
I would like them to hit and change course on hit this time around..
For this I made the variables that give the rocks there x and y speeds public.
Now I try to get the x and y speed of the colliding rock on collision to do some math on how to alter the rocks speed, this is where it goes wrong.
if (colliding_rock=collision(type rock)) x_speed=colliding_rock.x_speed\2; end
If I use this code I get the error "unknown identifier ( token error: "x_speed" ).
Can you see what I am doing wrong here?
Hi,
when you want to use public variables you need to "declare the process" so as the program knows which public variables has each process. Take a look at this page on the BennuGD wiki: http://wiki.bennugd.org/index.php?title=Declare
Hope it helps!
Hi,
I forgot to mention but I did declare the process and its public variables.
Could the problem be that I want to get variables from a process of the same type?
how you declare colliding_rock ?
make sure you declare colliding_rock as type rock
PRIVATE
rock colliding_rock; //this will give you type rock
PRIVATE
colliding_rock; //this will give you type int, and is probably causing your error
I am sure I didn't declare rock the way you describe here (I did it the way you describe not to do it..).
I think I always declare everything as INT, I will read in to what other ways there are and what they do.
I had this part of the game on hold for the moment, but I will experiment with it again as soon as I have time. I will let you know if it solved the problem.
Thanks for now!
(also to the others who posted here)
Maybe this page is of help: http://wiki.bennugd.org/index.php?title=Public_variables
The Beginner's Tutorial had more on this matter, but it was deleted for some reason.
Thanks, I think I will need to read into the different kind of data types for variables.
I have a new question now, I hope it is ok to ask it in this same threat.
The game is now coming along nicely and I would like to share it with some friends.
I used to copy the interpreter file and give it the same name as the .dbf file, this way you could start the game without using a command prompt. This doesn't seem to work anymore though.
How can I make an executable for my game now?
Edit:
I have it working now, I created a shortcut to the bgdi.exe and added ' gamename.dcb' as parameter.
If there is a more elegant solution I am still interested.