Need Help With This Game!

Blitz3D Forums/Blitz3D Beginners Area/Need Help With This Game!

WERDNA(Posted 2008) [#1]
Greetings, Mortals.
I am the Mighty WERDNA(Lord Of noobishness).
And I need help with my first 3D game.

Here is a link to where you can download the game,
it is called Robo Attack 3D V.2.

http://hosted.filefront.com/werdnaworld

And I will give a quick explaination of what I need help with.

first of all the game is played by collecting all of the dots,
and avoiding the enemy robots.
The walls of the maze can be shoved as well, to reposition them.

1 I know that my code is sloppy, and any suggestions
upon how to clean it up a bit would be appreciated.

2 I can get the robots to collide with the walls, but cannot get them to shove the walls like the player can.

3 I need serious help with getting types to collide.
I have given each and every, wall, robot, and dot, their
own type, and I'm am pretty sure that they each only need one type.
;EXAMPLE,
;For Robots = 1 to 100
;Robot.Robot = New Robot
;Robot\Robot_Type = NumOfType
;NumOfType = NumOfType + 1
;EntityType Robot,Robot_Robot_Type
;Next
;So every time a new robot is created, its Type = that of
;the last Robot + 1.


And then any suggestions as to what I should do with the game from here, would also be appreciated.
I intend to put in PowerUps and Boss's, and maybe online play as well.
And hopefully, this will turn out better than my first Robo Attack game.

Thanks everyone,

The Mighty WERDNA(Lord Of RoboAttack)


mtnhome3d(Posted 2008) [#2]
the
;Robot\Robot_Type = NumOfType
;NumOfType = NumOfType + 1
;EntityType Robot,Robot_Robot_Type
;Next 
;So every time a new robot is created, its Type = that of
;the last Robot + 1.
is not needed. they can share a collision type. i will look at the rest of the code too to see if i can spot other problems.


[edit] i looked at your code and it runs slowly due to the massive number of collision types and you should make your collision types const not global. i have a little trouble reading the code due to the random commented blocks if its not needed delete it. if your working on that section thats fine too.


blackbag(Posted 2008) [#3]
As above, you don't need all those entitytypes.

On paper, I would draw myself a grid , with all the different entity types on it, player, walls, robots for example.

Now I ask myself what can collide with what,
Can player collide with other players, walls, robots?
Can Walls collide with player, other walls, robots?
Can robots collide with player, walls or other robots?

I would then use this information to set collision types and then build my collision commands. Remembering that depending on the situation I may need to reference the collision both ways (player to robot and robot to player).


WERDNA(Posted 2008) [#4]
Thanks guys, for your help.
And all of the randomly commented code is stuff that I
may or may not put in.You can just ignore it.

If anyone else has any advice I would be happy to hear it.:)

The Mighty WERDNA(Lord Of Collision Checking)


WERDNA(Posted 2008) [#5]
I have updated the Robo Attack File so it is easier to read.

I have removed all pointless comments, and added
some helpful ones to explain the code better.
And I have modified collisions a bit, so they are now constants instead of globals.

I need more help with the collisions. when the Player grabs a dot for instance, all the dots act as if they had
been grabbed.Same with the walls.When you push one
wall, all walls of that type move.

So my questions are, How do I fix the above collision problem, and where do I put the following lines
of code.
Collisions Type_Player,Type_Dot
Collisions Type_Player,Type_Bot
Collisions Type_Player,Type_Wall1
Collisions Type_Player,Type_Wall2
;I just want to know where I'm supposed to put this.
;Do I put it in the main loop?, or in a function?.

Please Help.
Any Suggestions as to how to fix this, or variations on
this code, would be thoroughly appreciated.

The Mighty WERDNA(Lord Of Asking For Help)


Neo Genesis10(Posted 2008) [#6]
If you can, could you post your collision code for us? Its hard to go on just the collision types since the actual movement (or destruction) would be down to the code which controls those indivudual objects.

For example, when you do something like:
a = New Entity
Delete a
It would only delete the entity with the handle 'a', regardless of collision types. Same goes for any functions performed on that object, such as your example of moving the blocks.

Its possible you've got an error which applies the behavior to every object in the group by mistake. Sometimes having someone else take a look points out mistakes we never notice by ourselves ;)


WERDNA(Posted 2008) [#7]
Do you mean this?

For Wall.Wall1 = Each Wall1
Collisions Type_Player,Type_Wall1,2,2
If EntityCollided(Player,Type_Wall1)
If EntityX(Player) > Wall\x#
Wall\x# = Wall\x# - 0.01
ElseIf EntityX(Player) < Wall\x#
Wall\x# = Wall\x# + 0.01
End If
PositionEntity Wall\en,Wall\x#,Wall\y#,Wall\z#
End If

Next

This is the code for when the player collides with a wall.
He will then push it, but the problem is that all of the walls move, not just the one that he is touching.

I want to know how to fix that, so that only the wall
that he touches will move.

If you have any questions for me, or any more code that
you want me to post. I would be happy to do so.
And Thanks again everyone for your help.


mtnhome3d(Posted 2008) [#8]
he wants the collisions with the dots code. I tested it for a long time and it doesn't delete them all at once. i would use a check veriable to check which wall has been hit. something like
 
if entitycollided(player,wall) walhit=true
;then later use the walhit varible to move them.
if walhit=true movewall()



WERDNA(Posted 2008) [#9]
Now thats what I'm talking about!
Major Thanks Mayaman, that should fix it.


blackbag(Posted 2008) [#10]
You code checks to see if the player collided with a wall, you need to check to see if it collides with a specific wall, also you dont need the collision command at each iteration of the loop. I would go for somthing like,


;at some other point in the code, just once
Collisions Type_Player,Type_Wall1,2,2

For Wall.Wall1 = Each Wall1
	If EntityCollided(Player,Type_Wall1) = wall\en
		If EntityX(Player) > Wall\x#
			Wall\x# = Wall\x# - 0.01
		Else
			If EntityX(Player) < Wall\x#
				Wall\x# = Wall\x# + 0.01
			End If 
			PositionEntity Wall\en,Wall\x#,Wall\y#,Wall\z#
		EndIf
	endif 
next




WERDNA(Posted 2008) [#11]
Perfect,
Thanks so much everyone for all of your help.
Now I can finally continue work on Robo Attack 3D.

The Mighty WERDNA()
;I'm leaving the parantheses blank, because someone has been logging in as me and editing what I'm the lord of. It's kind of funny, but it must stop!