Create a 2d Shoot'em Up

BlitzMax Forums/BlitzMax Tutorials/Create a 2d Shoot'em Up

ftbass(Posted 2005) [#1]
Hi all,
I'm quite beginning in OOP, but I just wanted to share my work :)

Part 1 : Scrolling
Part 2 : Player's move
Part 3 : Add a bonus type
Part 4 : Tweening (just a method. waiting for suggestions :))
Part 5 : Collisions detection
Part 6 : Code organization (new)
Part 7 : Pixel perfect collision + sounds + particles (new)

Here are the .zip :)

Part 1 : Scrolling
Part 2 : Player's move
Part 3 : Add a bonus type
Part 4 : Tweening (just a method. waiting for suggestions :))
Part 5 : Collisions detection
Part 6 : Code organization (new)
Part 7 : Pixel perfect collision + sounds + particles (new)

Part 7 and following will need PartEngine

(based on T-Type project)

see ya


Pit-le-rouge(Posted 2005) [#2]
Thanks ftbass. Nice idea.
I just had a first look at your code.
That seems nice (I'm just a beginner in Blitz !).
Just two comments:
(1) If I look t this part of code in the Tbonus type (just an example):
If Self.x < 0 - 64 Then
ListeBonus.Remove Self
If Rnd() >= .5 Then
CreateBonus(1024, RndFloat() * 768, "Vitesse")
Else
CreateBonus(1024, RndFloat() * 768, "Tir")
You "hardcode" the size of the sprites (64) and the size of the sceen (1024,768). It's probably better to detect the sizes at the beginning and put them in variables. Your code will be more "independent" from your images/screen size.

(2) just two ideas (maybe not so good, i'm a beginner... ;-) for the collision detection:
- why don't use "collideimage" function (pixel perfect - good examples on this forum) ?
- why don't add the collision detection in each object (type) ? In this case, each "object is responsable to detect the collsion with those wich have an influence on his "life". This can be more "OOP"...


ftbass(Posted 2005) [#3]
thx for your comments :)

you're right for the 1st point, i'll correct it.
I must be blind because I didn't see the "collideimage" function lol. Now I know it exists. Fine :)
Finally i'll try to add collision detection in each object.

Merci Pit-le-rouge pour ces quelques points à travailler :)

a+


Pit-le-rouge(Posted 2005) [#4]
Mais de rien ftbass ;-)

I'm coding a phoenix-clone.
And, as you, I dicovered a lot of tips in the blitz's forums !
Blitz community is really great ! They share a LOT of examples !


Steve Elliott(Posted 2005) [#5]
A zip version please.


ftbass(Posted 2005) [#6]
Here are the .zip :)

Part 1 : Scrolling
Part 2 : Player's move
Part 3 : Add a bonus type
Part 4 : Tweening (just a method. waiting for suggestions :))
Part 5 : Collisions detection
Part 6 : Code organization (new)
Part 7 : Pixel perfect collision + sounds + particles (new)

Part 7 and following will need PartEngine


see ya


AdrianT(Posted 2005) [#7]
before I forget, thanks :) always nice to find new things for a beginner to learn from :)


ftbass(Posted 2005) [#8]
I'm really in war with the CollideImage() function :(

I can see that there are collisions, but when there are collisions, CollideImage() returns me a null object...

It would be very nice if someone was able to show me how it works with an example based on the 6th part of my tutorials.

thx, see ya


Perturbatio(Posted 2005) [#9]
My first collisions experiment:



ftbass(Posted 2005) [#10]
thx for helping, but BlitzMax doesn't want to compile :(

"Compile Error
Unable to convert from 'TImage' to 'Int'" (on line 56)

I've just seen the ImagesCollide2() function, simpler for me to use, it should be OK (it is in fact. I've just tried) :)

ps: is it a new function, or am I totally blind O.o ?


Perturbatio(Posted 2005) [#11]
ImagesCollide has a slight bug, see this thread for the easy fix:
http://www.blitzbasic.com/Community/posts.php?topic=43386
(remember and recompile the modules)


ftbass(Posted 2005) [#12]
Many thx Perturbatio, I didn't know. Let's try :)


Perturbatio(Posted 2005) [#13]
ImagesCollide2 suffers from the same issue.


ftbass(Posted 2005) [#14]
Waouh... I feel a little bit lost between
ImageCollide()
CollidesImage()
CollidesImage2()...

Anyway, I put my finger on a confusing point (for me) thanks to you :)

thank you very much, see ya


ftbass(Posted 2005) [#15]
Here has come the 7th part, featuring pixel perfect collisions, sounds, and particles.


Perturbatio(Posted 2005) [#16]
I get very inconsistent running speeds; The stars move at a reasonable rate for a period of time then suddenly shoot along for about a second.
Also the ship after a while moved up and down in jumps of about 200-300 pixels.


ftbass(Posted 2005) [#17]
I'm not very proud of my tweening routine (works fine on my PC, but wanna see how it does on other configurations)... ("just a method, waiting for suggestions" writen in the 1rst post :))

If you take green bonus, the speed of the ship increases without any limit. It will be fixed in the future parts.

Happy to see you tried :)

see ya


insomnia(Posted 2005) [#18]
Hi

When i compile with 1.03 core it work. But when i use 1.05 i get an error that he miss a file called blitzgldll.a


ftbass(Posted 2005) [#19]
quite strange... I have no error with the 1.05...
Could anyone else test it, and let us know the issue ?

thx


Pit-le-rouge(Posted 2005) [#20]
Ftbass,
I'm on Mac os...
Do you have a mac version of the Part_engine ?


SillyPutty(Posted 2005) [#21]
I really want to go through this code, but what language are the variables and comments in ?


ftbass(Posted 2005) [#22]
Pit, I sent the code of PartEngine to you, so you should see the result. Check your e-mail :)

this code is a BlitzMax tutorial, Deux :)


SillyPutty(Posted 2005) [#23]
I mean speaking language :)

I know it is in bmax, hehe


ftbass(Posted 2005) [#24]
lol... this is french sorry
My english is not really good, but I should have tried to translate...
In the 8th part, I'll try to write comments in english :)

ps: have you tried Google translation tool ?


SillyPutty(Posted 2005) [#25]
I will try that, or just guess.


Koekelas(Posted 2005) [#26]
Looks really nice ftbass, I really like it. Just one question, do you have a Macintosh version of PartEngine?


Nicolas.


ftbass(Posted 2005) [#27]
Sorry, I'm really late :/

I've no Mac version of PartEngine, but you can find it there:
http://www.blitzbasic.com/Community/posts.php?topic=43248
or in my personnal web site:
http://ftprods.free.fr

So you can build the Mac module, or simpler, use it as an extern library :)

see you


Augen(Posted 2005) [#28]
Filax, why don't you edit the original message. Put the links to .zip files in the original message. That may make it more clear that you have .rar and .zip files available.

Thanks for the tutorials. More tutorials are needed for BMax. There is much difference between B3D and BMax.

Edit: I could've sworn the top message had filax as the author. Sorry for that ftbass and filax.


ftbass(Posted 2005) [#29]
I'm known as ftbass, but you can call me however you want ;)

I edited the first post

regards


Filax(Posted 2005) [#30]
What ???


ImaginaryHuman(Posted 2005) [#31]
Does someone have a screenshot of this thing running?


ftbass(Posted 2005) [#32]
Strange O.o
That worked with blitzmax beta, but no more yet :(

I'll take a look to see if I can fix what's going wrong with this thing ;)

see ya


KristoDJ(Posted 2008) [#33]
Hi, it does not work, and there is no wai to make it run...
Always the same error: "Identifier TEmitteur not found"... :(((


AltanilConard(Posted 2008) [#34]
That's because you need PartEngine (the link is in his first post). You will also have to modify the source so it runs in the newest blitzmax, which shouldnt be too hard (removing bglSetSwapInterval ( 0) and chaging FlushMem to Flip, maybe some more).


KristoDJ(Posted 2008) [#35]
Humm... actually I downloaded both the beta5 and beta 6 but it didn't work... I did copy-paste the source code and rebuilt the module after correcting it, I had to add the ":TImage" type declaration after each image variable, and work on each tutorial acting as you suggested, but now it seems to work properly.

Thank you! ;)


itsdanreed(Posted 2008) [#36]
Forget it :)


tonyg(Posted 2008) [#37]
Why take the extra time to type self.x?

Not sure which bit you're referring to but :
Encapsulation?