November 12, 2009 at 2:14 pm #3131
ok so either im very tired or i just cant seem to figure out how to get the thrust effect to go behind the ship and stay with it as it moves left or right.
cut down code any help? lol im new to 2D stuff
im using the simple thrust from the shootem up eff in this
[attachment=0:1o4ootsp]Spacestuff.rar[/attachment:1o4ootsp]November 12, 2009 at 9:59 pm #3541
ok i have made some head way into this i can now position my effect to were i want it but how do i get it to update its position as the ship moves?
to mutch of the code is oop and makes it hard for newer people to read so maybe add some demos etc that dont require as mutch oop.
makes them easy to follow then as the only demo with sprites is vaders and thats way to harsh to figure out if your new.
Local MyEffectsLib:tlEffectsLibrary = LoadEffects("efx/Effects.eff") ' change to shoot em up eff
Local MyEffect:tlEffect = MyEffectsLib.GetEffect("PlayerThruster") ' simple thruster
Local MyParticleManager:tlParticleManager = CreateParticleManager()
PlayerShip:TPlayerShip = New TPlayerShip
PlayerShip.Image:TImage = LoadImage( "GFX/PlayerShip65.bmp" ) ' Error 001
Local Tweener:tTweener = New tTweener.Create(30)
Local TempEffect:tlEffect=CopyEffect(MyEffect, MyParticleManager)
While Not KeyDown(KEY_ESCAPE)
For Local Ticks:Int = 1 To Tweener.FrameTicks
Field X:Int = 600
Field Y:Int = 702
Field Speed:Int = 3
Field Lives:Int = 3
Field Weapon:Int = 1
Field ShieldState:Int = 0
Field ShieldEnergy:Int = 0
Function Create:TPlayerShip(File:String, XStart:Int, YStart:Int )
Local Ship:TPlayerShip = New TPlayerShip
Ship.X = XStart
Ship.Y = YStart
Ship.Image = LoadImage( LoadBank(File) )
If Ship.Image = Null
Notify "Error: 001 Unable to load gfx"
If KeyDown( KEY_LEFT )
If KeyDown( KEY_RIGHT )
If X < 0 Then X = 0
If X > 1195 Then X = 1195
DrawImage Image, X, Y
End TypeNovember 12, 2009 at 10:18 pm #3542
Hello, I changed quite a few things which I marked with remarks. The main thing was to put a new field in the ship type to contain the thruster effect. You can then use this to update its position in the UpdateState Method. I also changed the timing code a bit. Logic updates should go in the for..next loop and rendering should happen outside. Take a look at this example: http://www.rigzsoft.co.uk/index.php?option=com_content&view=article&id=25 for a basic timing example using the tweener mod. If you understand that then you can add tweening to you spaceship as well.
It is is very OO and can be tricky to get used to but very much worth it in the end. I recommend the basic game tutorial here on this site: http://www.rigzsoft.co.uk/index.php?option=com_content&view=category&id=11&Itemid=11 and I also wrote another tutorial about making an asteroids game that actually uses the thruster effect. I wrote that for the Blitzmax coder magazine but I’ll attach a copy here in this thread if you missed it, I’ll just go dig it out…November 12, 2009 at 10:26 pm #3543
Here is the Asteroids tutorial attached, and all the source code for it is here: http://www.rigzsoft.co.uk/files/asteroidstutorialpart3.zipNovember 13, 2009 at 12:32 pm #3544
gonna check it over now thanx
You must be logged in to reply to this topic.