123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|644|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Newbie in need of help

Thu, 10 Apr 2008, 11:02
Baldwin
The blitz plus demo tutorial sucks and didn't help me at all with this. I'm trying to create a game for my senior project at school and I swear, they need to make the 'intro' to game programming longer than a single semester.

Unfortunately Blitz seems to only give you one error report at a time, but the one I have right now seems to be spitting me in the face.



My teacher only taught us how to use types in thirty minutes. I used one of our other programs as the structure for this, and based on that structure, which works great, this should work. However I keep running into the error "Custom type name not found", or something along those lines.

I'm trying to see if the program actually works so I can use it in my lesson plan so I can get this damned senior project done. I would have gone to the BB website, but of course, you need to buy the product just to register.

Do you guys mind if you help me iron this out?

Thanks,
Baldwin

Here's the images:
s14.photobucket.com/albums/a325/coalition/?action=view¤t=P-Projectile.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=P-Missile.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=E-Projectile.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=E-Missile.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=E-Jet.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=Plane.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=Bomber.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=explosion.jpg
s14.photobucket.com/albums/a325/coalition/?action=view¤t=P-Jet.jpg
Thu, 10 Apr 2008, 11:21
JL235
Good languages will give you all the errors they find, good IDE's will tell you those errors before you hit compile. I dunno if you realise but when Blitz finds an error it'll move the cursor to the line where it finds it. This is a little confusing it's not highlighted or anything, but that is where the error is.

In this case it moves to the line 'EJet.jet = new EJet', which is where the error lies. This is because EJet is the variable whilst jet is the type. 'EJet.jet' is saying that the variable 'EJet' will be used to hold a 'jet'. To then make a new Jet to be held by the variable it's then 'new jet' not 'new EJet'.

The others lines below are also wrong as the same applies to them too.

I hope that helps.
Thu, 10 Apr 2008, 15:11
Jayenkai
In addition to that, you're using the same variable name for two different things..

First you define EJet as a image-variable..
Global EJet = LoadImage("E-Jet.bmp")

And then again as a type-variable
Global EJet.jet = New EJet

Same variable name.
You'll be better off renaming the image variables, to either
Image_EJet, or EJet_I, or something to that effect, so that there's a clear distinction between the two.


Oh, and Blitz doesn't care about the cases of variable names, so having one be EJet, and the other eJet won't matter to it! (I say that because you've labelled one variable "EMissIle" with a capital I in the middle..)

-=-=-
''Load, Next List!''
Thu, 10 Apr 2008, 16:58
Jayenkai
(couple of posts moved to alternate topic)

-=-=-
''Load, Next List!''
Mon, 14 Apr 2008, 09:36
Baldwin


Thanks, it fixed that one. Now when I'm trying to draw the images onto the page, it tells me that the variable must be a type. I've used it three different ways:

DrawImage (PJet.player,P_Jet\x,P_Jet\y)
DrawImage (EJet.jet,E_Jet\x,E_Jet\y)
DrawImage (Plane.misc,Plane_\x,Plane_\y)
DrawImage (Bomber.misc,Bomber_\x,Bomber_\y)

DrawImage (PJet,P_Jet\x,P_Jet\y)
DrawImage (EJet,E_Jet\x,E_Jet\y)
DrawImage (Plane,Plane_\x,Plane_\y)
DrawImage (Bomber,Bomber_\x,Bomber_\y)

DrawImage (player,P_Jet\x,P_Jet\y)
DrawImage (jet,E_Jet\x,E_Jet\y)
DrawImage (misc,Plane_\x,Plane_\y)
DrawImage (misc,Bomber_\x,Bomber_\y)

All had the same results. Why does it have to be a type? I thought it was supposed to be DrawImage (-image-,-image x-,-image y-).
Mon, 14 Apr 2008, 09:39
Jayenkai
PJet.player isn't an image.. P_Jet is the variable you used for your image..

Blitz is getting even itself confused!
So, where it's saying "Must be a type" it actually means "Really shouldn't be a type!!"

It should just be the image's variable name.

-=-=-
''Load, Next List!''
Mon, 14 Apr 2008, 10:48
Baldwin
Yeah, but when I do that it still gives me that error for the same line.
Mon, 14 Apr 2008, 12:34
codingmonkey

acording to your code,

P_Jet is the handle for your image loaded in from the bitmap file "P-Jet.bmp"
same applies to the enemy jet of E_Jet too.

I suggest placing a handle inside your types. And perhaps a different name for both the player and enemy jets.
Even only one unique generic type for the jet itself.
Then when instantiating the type you have one player jet and as many enemy jets you want.


Wed, 16 Apr 2008, 09:48
Baldwin
Could you dumb that down for me please? Or at least show an example?
Wed, 16 Apr 2008, 09:58
Jayenkai
I think (?) that what he's suggesting is using _Type, _Image, and _Instance type things..
So you'd have
Type Jet_Type
end type

Jet_Instance=Jet_Type
Jet_Image=LoadImage("")
and things like that..
You'd be able to keep track of what's what, and how it should be used, a little easier.

-=-=-
''Load, Next List!''
Wed, 16 Apr 2008, 21:17
Orion Pax
Yeah. You have a lot of your variables from your types and your images mixed up. Even I noticed that. Not making fun of you but I am a bit of a newb. I havent produced anything GOOD YET but I am working on something now thats gonna change that. W00T! I am definitely considering a 2D game soon as well. So be looking for me posting about help there!
Tue, 22 Apr 2008, 12:16
Baldwin
-got it-
Sat, 26 Apr 2008, 11:24
Baldwin


I'm likely missing something very obvious, but, eh. Whenever I start it up, they all sit in the top left corner and do nothing. They seem to fire a missile and projectile, but they don't move either. I've set their x and y coordinates in the Initialize Level function, but alas, they sit on their asses.

Also near the bottom of the code, in the If ImagesOverlap section, it says I don't have enough parameters. However I already have it set up to draw an explosion still image at the same coordinates of whatever is going to explode when they do overlap. What else would I need?
Sat, 26 Apr 2008, 13:28
Forklift_Fred
You aren't specifying which images to check. the full parameters should be:

ImagesOverlap( image_1_handle, image_1_x, image_1_y, image_2_handle, image_2_x, image_2_y )

However, if you have transparencies in your amages and want to be more precise then you should be using ImagesCollide() which also requires a frame reference for each image (if it's not an animated image then it counts as frame 1:

ImagesCollide( image_1_handle, image_1_x, image_1_y, image_2_frame, image_2_handle, image_2_x, image_2_y, image_2_frame )

I've not looked at the movement aspect.

-=-=-
Come rain or shine...
Sat, 26 Apr 2008, 14:37
Baldwin
Thanks much. I don't think the students I'm gonna teach with this know much about animation, so I'm gonna stick with overlap in this.

Now just to figure out how to fix their positions.
Sun, 27 Apr 2008, 10:40
Baldwin


I've solved the position (except that the explosion ends up appearing at the top left), but I still have no movement, not even by my own character. I have AI activity, as I keep dying, but absolutely no movement.
Sun, 27 Apr 2008, 15:32
Jayenkai
Your defining the player as
Global Fighter.player = New player
So, whenever you access it's X and Y co-ords, you should actually be using
Fighter\X and Fighter\Y
because they're set up to be part of the .player type.

However, you're using a seperate set of FighterJetX and FighterJetY variables.
Because you haven't set those up, nor made them Global, they're just not being used at all.

Go through your code, and make sure the variables you're using are those that you set up in the types, so they're linked to the actual objects.

-=-=-
''Load, Next List!''
Sun, 27 Apr 2008, 16:00
Baldwin
I combed through it earlier and got the movement checked out. Been pouring through the snippets trying to find the correct code for transparency for the last twenty minutes, but I had too much fun with the fire program.

Right now I don't think that types will be neccessary now, unless I want to add more than one of each, since I have it on simple x y variables.

Only problem now seems to be not being able to move the weapons. They draw, but they won't seek properly.

When I use:
"If KeyHit(FIREKEY)
DrawImage (PProjectile,FighterJetx,FighterJety)
Flip
PProjectiley = PProjectiley - PROJECTILESPEED
End If"

It just sits in the middle of the player image. Same goes for the enemies and both missiles.

If I use:
"If KeyHit(FIREKEY)
DrawImage (PProjectile,FighterJet,FighterJetx,FighterJety)
Flip
PProjectiley = PProjectiley - PROJECTILESPEED
End If"

I get an error stating: Illegal Image Frame index:575.


Sun, 27 Apr 2008, 18:18
Baldwin


For the most part, it is now a..."game".
I'll just make them look at other pre-existing games on their computer and offer extra credit to those who can manage to correct the weapons issue. =D
Mon, 28 Apr 2008, 04:54
mike_g
Ok, heres a bit of your code:

It looks as if you are drawing your projectile at the bombers location.

You then flip the backbuffer, which you dont need to be doing here; you should only need to call flip once at the end of your main loop.

Once you have called flip you then move the projectile, but on the next loop you reset the projectiles position to the bomber location. You really need to have variables to track the missiles co-ords.

I noticed that you are not using types at all. I suggest you learn how to use them; you will need them for a game like this. With types you can create instances of objects such as an enemy, or projectile which each have their own set of variables. You can then loop through each of these objects moving them, checking for collisions, etc.
Mon, 28 Apr 2008, 13:46
Forklift_Fred
Couple of key pointers there, worth highlighting I think.

you should only need to call flip once at the end of your main loop.
This caught me out several times early on. Exception to the rule (because there always are!) would be stand alone functions, maybe you have an introduction/menu function or level editor function... but even then there would be a single Flip command at the end of the loop.

I noticed that you are not using types at all.
I'll start with the exception this time... When you only have 1 or 2 characters/fighters/missiles then you may find it easier to stick to normal variables, especially if you are still getting to grips with the language. However, once you get into larger amounts of characters and especially missiles then Types are a god-send. Missiles and bullets especially because you can fire as many as you like and just keep adding more and more (and then delete them as they hit their target or reach their limit)

In your case, if I've read your code correctly and there is just one player and one enemy, I'd suggest you stick to normal variables for the planes but venture into Types for the missiles. You can always step up to types for the enemies later if you want to add more. That's my thinking anyway, hanging onto something easier so at least part of it works while you always play with types. You may prefer to dive straight in and only use Types but since you pulled away from them already...

Types can be quite easy at the basic level but it can be tricky to find an explanation that clicks with your way of thinking. There are people asking about Types and it doesn't matter how many times they get answered there are still people that need it explained to them personally. Give it a go but don't be afraid to ask

-=-=-
Come rain or shine...