In this example my bullets have problems
Blitz3D Forums/Blitz3D Beginners Area/In this example my bullets have problems
| ||
; I cant work out why my bullets stop when I fire another ; also any ideas on how to put a timer on them so they ; only go so far ; I suck at this so please don't laugh at my crappy code ; cheers all :D Global gameFPS = 50 Graphics3D 1024,768,32,2 SetBuffer BackBuffer() Global camera = CreateCamera () CameraZoom camera,1.6 CameraRange camera,.1,100000 CameraClsColor camera,0,0,0 PositionEntity camera,0,140,-800 light = CreateLight() PositionEntity light,0,0,0 AmbientLight 150,150,150 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;Setup random target newpoint and timer t=0; timer set for newpoint (new co-ordinates) for ENEMY to go to l=500; life of generated bullet enemy=CreateCube() PositionEntity enemy,100,0,-50 ScaleEntity enemy,5,10,5 EntityColor enemy,0,255,0 newpoint=CreateCube() xx=Rnd (800); then create new target point zz=Rnd (800) PositionEntity newpoint,xx,0,zz ScaleEntity newpoint,5,40,5 EntityColor newpoint,0,255,0 ;create player px=0:pz=-500 ;Set player start co-ords player=CreateCube() PositionEntity player,px,0,pz EntityColor player,0,0,255 ScaleEntity player,10,30,10 ;player weapon weapon=CreateCylinder() PositionEntity weapon,px,15,pz+15 ScaleEntity weapon,4,10,4 RotateEntity weapon,90,0,0 EntityColor weapon,50,100,255 EntityParent weapon,player ;parent the weapon to the player ;create landscape Plane=CreatePlane() EntityAlpha Plane,0.8 PlaneTexture=CreateTexture(128,128,9) ClsColor 0,0,255 Cls Color 255,255,255 Rect 0,0,64,64,1 Rect 64,64,64,64,1 CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(PlaneTexture) ScaleTexture PlaneTexture,40,40 EntityTexture Plane,PlaneTexture,0,0 Repeat ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;Generate random xx,zz co-ordinates for enemy to move towards t=t+1 ;count timer If t>1000 ;if timer >2000 xx=Rnd (1000) zz=Rnd (1000) PositionEntity newpoint,xx,0,zz ;set down the target t=0 ;reset the timer EndIf ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX If EntityDistance( enemy, newpoint )>1 PointEntity enemy, newpoint MoveEntity enemy, 0, 0, Rnd( .5, .5 ) EndIf ;update camera PointEntity camera,player ;controls If KeyDown(205) Then TurnEntity player,0,-.5,0 If KeyDown(203) Then TurnEntity player,0,0.5,0 If KeyDown(200) Then MoveEntity player,0,0,0.3 If KeyDown(208) Then MoveEntity player,0,0,-0.3 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;XXXXXXXXXXX HERE IS WHERE I NEED HELP PLEASE XXXXXXXXXXXXXX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;I can shoot the bullet.. but if I shoot another one the current one ;just pauses while a new one is generated. Raghhhhh!!!!... ;I have tried to put a timer on it but to no avail ;I don't know why its not working..barring in mind I suck at this :( XX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX If KeyHit(57) ;The SPACE key to FIRE bullet PointEntity enemy, Player Bullet=CreateCube(player) EntityColor bullet,222,0,0 ScaleEntity Bullet, 0.2, 0.04, 0.2 PositionEntity bullet,0,.5,0 ;seems the z is 1/2 the player height ? I think EntityParent Bullet,0 EndIf If Bullet ;if a bullet exists MoveEntity Bullet, 0, 0, 5 ;3rd number is bullet speed EndIf l=l+1 If bullet And l>200 MoveEntity bullet,0,-20,0;hide the bullet until i work out how to destroy it. l=0 ;reset bullet timer EndIf UpdateWorld RenderWorld Flip Forever |
| ||
Try to do a separate test on how your bullet 'timetolive' routine will work. This way you can focus and check what works. |
| ||
Bullet=CreateCube(player) Your bullet stops moving because you overwrite the entity handle of the bullet entity stored in 'Bullet' with a new entity handle. You're also introducing a memory leak that way as the entity handle for the old bullet is effectively lost and you have no way to manage or delete its cube entity. If you want to manage the entity handles for multiple bullets then you need to store them on an array or linked list (custom type list). Something else to be aware of is that the 'And' and 'Or' operators aren't logical operators that operate on True (non-zero) and False (zero) values. They're actually bitwise operators that operate on comparing bit patterns, so you've got to be careful how you use them. You can find info about all of this by browsing the help files found in the 'Help' tab in the Blitz3D editor, and also by browsing the manuals and tutorials on this website. |
| ||
Something else to be aware of is that the 'And' and 'Or' operators aren't logical operators that operate on True (non-zero) and False (zero) values. They're actually bitwise operators that operate on comparing bit patterns, so you've got to be careful how you use them. This is a surprise. According to the docs: AND is a logical operator for doing conditional checks of multiple values and/or expressions. Use this to ensure that two or more conditions are true, usually in an IF ... THEN conditional. See example and see OR, NOT, and XOR. Yet this sample shows that And behaves in a bitwise fasion. Local a = 17 Local b = 254 Print a And b ;prints 1 if And is logical, 16 if bitwise Shouldn't be a problem with Phodis' code, as AND has a lower precedence than >, and should evaluate correctly. |
| ||
While we're on the topic of dodgy docs, it's a good idea to check out the online versions of the manuals that are linked in the main menu on this site. The comments often have useful info that fleshes out the commands. A lot of the original documentation found in the editor 'Help' tabs is pretty shoddy. |
| ||
From my past tests, AND can be written inside a if() for example : if( A = 1 AND B = 2 AND C = 3 ) whereas OR is like having a separate if() for example : if( A = 1 OR A = 2 OR A = 3 ) is the same than : if( A = 1 ) OR if( A = 2 ) OR if( A = 3 ) so to prevent confusion, it is better to not mix AND and OR in the same if() for example : if( A = 1 AND B = 2 AND C = 3 ) OR (A = 2 ) OR ( A = 3 ) related to this : http://www.blitzbasic.com/Community/posts.php?topic=105967 |
| ||
you have two possibilities: First way: your wappon cannot shoot, before the last shoot has ended: If (Bullet=NULL) AND KeyHit(57) PointEntity Player, Enemy Bullet=CreateCube(Player) ...... EndIf If Bullet MoveEntity Bullet, 0, 0, 5 If EntityDistance(Bullet, Player)>40 FreeEntity Bullet Endif EndIf by the way... you have an error in your "PointEntity" code line: If the bullet should fly from Player toward Enemy, the PointEntity() commands need the Player as first argument, the enemy as second. Second Way: multiple Shoots Type TBullet Field Ent% End Type If KeyHit(57) PointEntity Player, Enemy Bullet.TBullet=New TBullet Bullet\Ent=CreateCube(Player) ...... EndIf For Bullet.TBullet=Each TBullet MoveEntity Bullet\Ent, 0, 0, 5 If EntityDistance(Bullet\Ent, Player)>40 FreeEntity Bullet\Ent Delete Bullet Endif EndIf More complicated, because you need to know all about TYPEs. A TYPE is a user defined Object. A FIELD is a property of this object. In our example ENT is a property that will contain an ENTITY. The advantage of types is, that you now can create multiple objects, each can contain an Entity. All objects are stored in a list. With the command FOR/EACH you can go through that list. To create a new bullet-object to have to write: Bullet.TBullet= New TBullet. Because the Entity is now a property of the object TBULLET you have to write "Bullet\Ent" to use it. |
| ||
Hi guys, Firstly thanks to all your input here. I have been busy and not able to do a lot recently with the program... but I did manage to get my character to fire. I am intrigued with Midimasters below code... If (Bullet=NULL) AND KeyHit(57) PointEntity Player, Enemy Bullet=CreateCube(Player) ...... EndIf I am guessing NULL is a command... I have NOT looked it up yet. But I was unable in the brief time I have played with it to get that to work. Thus I still have to problem of the bullet not reaching an end of its path as when I press Space to fire again it re-sets the bullet...bahh I will get this :D Also.. unlike Gamemaker... when I spawn multiple enemies as in the below example they do not all move independently...only one of them does... Do I have to use that piece of code as a function maybe?.. Loving this stuff :D Will post more updates as I can .... I hope there is at least ONE person out there that might be worse at programming than me that may find some of the below of value.. Cheers all./ Global gameFPS = 50 Graphics3D 1024,768,32,2 SetBuffer BackBuffer() Global camera = CreateCamera () CameraZoom camera,1.6 CameraRange camera,.1,100000 CameraClsColor camera,0,0,0 PositionEntity camera,0,140,-800 light = CreateLight() PositionEntity light,0,0,0 AmbientLight 150,150,150 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;Setup random target newpoint and timer t=0 ;create enemy For qty=1 To 8 ;OK SO HERE I SPAWN 8 ENEMIES ex=Rnd(300) ;Only ONE of the buggers moves as it should tho :( ez=Rnd(300) ;Im not really sure if I should maybe make enemy=CreateCube() ;Multiple Enemies with different names maybe PositionEntity enemy,ex,0,ez ;The answer is probably simple..Im stuck. ScaleEntity enemy,10,30,10 EntityColor enemy,255,0,0 Next ;create newpoint newpoint=CreateCube() xx=Rnd (800); then create new target point zz=Rnd (800) PositionEntity newpoint,xx,0,zz ScaleEntity newpoint,5,40,5 EntityColor newpoint,0,255,0 ;Create sky ;sky = CreateSphere() ;skytexture = LoadTexture("sky.jpg") ;EntityTexture sky,skytexture ;ScaleEntity sky,2000,2000,2000 ;FlipMesh sky ;create player px=0:pz=-500 ;Set player start co-ords player=CreateCube() PositionEntity player,px,0,pz EntityColor player,0,0,255 ScaleEntity player,10,30,10 ;player weapon weapon=CreateCylinder() PositionEntity weapon,px,15,pz+15 ScaleEntity weapon,4,10,4 RotateEntity weapon,90,0,0 EntityColor weapon,50,100,255 EntityParent weapon,player ;parent the weapon to the player ;create landscape Plane=CreatePlane() EntityAlpha Plane,0.8 PlaneTexture=CreateTexture(128,128,9) ClsColor 0,0,255 Cls Color 255,255,255 Rect 0,0,64,64,1 Rect 64,64,64,64,1 CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(PlaneTexture) ScaleTexture PlaneTexture,40,40 EntityTexture Plane,PlaneTexture,0,0 Repeat ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ; MAIN LOOP ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;Generate random xx,zz co-ordinates for enemy to move towards t=t+1 ;count timer If t>2000 ;if timer >2000 xx=Rnd (2000) zz=Rnd (2000) PositionEntity newpoint,xx,0,zz ;set down the target t=0 ;reset the timer EndIf ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX If EntityDistance(enemy,player)<300 And EntityDistance(enemy,player)>40 PointEntity enemy, player ;enemy faces player MoveEntity enemy,0,0,Rnd(.5,.5) Else If EntityDistance( enemy, newpoint )>50 PointEntity enemy, newpoint ;move towards player MoveEntity enemy, 0, 0, Rnd( .5, .5 ) EndIf PointEntity camera,player ;controls If KeyDown(205) Then TurnEntity player,0,-.5,0 If KeyDown(203) Then TurnEntity player,0,0.5,0 If KeyDown(200) Then MoveEntity player,0,0,0.6 If KeyDown(208) Then MoveEntity player,0,0,-0.6 If KeyHit(57) ;The SPACE key to FIRE bullet If bullet FreeEntity bullet EndIf PointEntity enemy, Player Bullet=CreateCube(player) EntityColor bullet,222,0,0 ScaleEntity Bullet, 0.2, 0.04, 0.2 PositionEntity bullet,0,.5,0 ;seems the z is 1/2 the player height ? I think EntityParent Bullet,0 EndIf If Bullet ;if a bullet exists MoveEntity Bullet, 0, 0, 5 ;3rd number is bullet speed EndIf ;Else If bullet And EntityDistance(player, bullet)>100 ;FreeEntity bullet ;EndIf UpdateWorld RenderWorld Flip Forever |
| ||
I minmized your code to point to the important elements of TYPE based enemies: The code shows how to move enemies independent. Test it: Graphics3D 1024,768,32,2 SetBuffer BackBuffer() Global camera = CreateCamera () CameraZoom camera,1.6 CameraRange camera,.1,100000 CameraClsColor camera,0,0,0 PositionEntity camera,0,140,-800 light = CreateLight() PositionEntity light,0,0,0 AmbientLight 150,150,150 ;******************************************************* ;create enemy as a TYPE: Type TEnemy Field Ent% End Type For i%=1 To 8 Enemy.TEnemy=New TEnemy Enemy\Ent=CreateCube() PositionEntity Enemy\Ent, Rnd(-600,600), 0, Rnd(-300,300) ScaleEntity Enemy\Ent,10,30,10 EntityColor Enemy\Ent,255,0,0 Next ;******************************************************* player=CreateCube() PositionEntity player, 0, 0, -500 EntityColor player,0,0,255 ScaleEntity player,10,30,10 Plane=CreatePlane() EntityAlpha Plane,0.8 PlaneTexture=CreateTexture(128,128,9) ClsColor 0,0,255 Cls Color 255,255,255 Rect 0,0,64,64,1 Rect 64,64,64,64,1 CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(PlaneTexture) ScaleTexture PlaneTexture,40,40 EntityTexture Plane,PlaneTexture,0,0 Repeat ; ****************************************** ; move TYPE based Enemies: For Enemy.TEnemy= Each TEnemy PointEntity Enemy\Ent, player MoveEntity Enemy\Ent,0,0,Rnd(0,.5) Next ;******************************************* If KeyDown(205) Then TurnEntity player,0,-.5,0 If KeyDown(203) Then TurnEntity player,0,0.5,0 If KeyDown(200) Then MoveEntity player,0,0,0.6 If KeyDown(208) Then MoveEntity player,0,0,-0.6 UpdateWorld RenderWorld Flip Forever If you are not familiar with TYPES and if you do not understand... here is a version based on an ARRAY: Replace the two part in code above: ..... ;******************************************************* ;create enemy in an ARRAY: Dim Enemy%(9) For i%=1 To 8 Enemy(i)=CreateCube() PositionEntity Enemy(i), Rnd(-600,600), 0, Rnd(-300,300) ScaleEntity Enemy(i), 10,30,10 EntityColor Enemy(i), 255,0,0 Next ;******************************************************* ..... Repeat ..... ; ****************************************** ; move ARRAY based Enemies: For i%=1 To 8 PointEntity Enemy(i), player MoveEntity Enemy(i), 0,0,Rnd(0,.5) Next ;******************************************************* ..... |
| ||
Hi Midimaster, Thanks for your guidance on this, and for taking the time to help me out. Its really appreciated and does help. I tried to run the first program above, but I get an "expected Identifier" error when I run the program. The program seems to pause on the line For Local i%=1 To 8 I have to race off to work but will get into it tonight ASAP. Again thanks so much for going to the trouble. Cheers |
| ||
remove the word local and it should work fine. |
| ||
sorry, my bug... this was a little bit "BlitzMax"-style. Without the word "local" it will work. I corrected the code now. Thanks, Matty! |
| ||
Arhhhhhh Thanks Matty... just home for lunch and gave it a shot.... This is so much fun :D Cheers guys I'll keep at it and let you know how I go! |
| ||
With one variable ENEMY you can create some ENTITYs, that is no problem. When you create the second ENEMY, the first will still be alive, but you will (forever) loose control on it . So you need 8 variables to control the 8 enemies. The easy solution is an ARRAY. This will provide you ENEMY(1), ENEMY(2) to ENEMY(8). But before you can use it, you have to define the max number with DIM Dim Enemy%(10) Now you can control it with... Enemy(1)=... ...or also... i%=2 Enemy(i)=.. To control all 8 you use a LOOP: For i%=1 to 8 Enemy(i)=... Next The advanced way is to use a TYPE LIST. Type TEnemy Field Ent% End Type This is a user defined TYPE. You already know some TYPES like STRING INTEGER or FLOAT. Now you have a new one (your own): TENEMY. The "T" in front is often used for showing "its a type". The TENEMY itself cannot contain the entity. Therefore you need a FIELD. So Ent% is the field for containing the ENTITY. At the beginning there is no variable of the type TENEMY. You first have to create it : Type TEnemy Field Ent% End Type Enemy.TEnemy = New TEnemy strange code line, but a must! Now you have the variable. but it is still empty. Fill it with an ENTITY: Type TEnemy Field Ent% End Type Enemy.TEnemy = New TEnemy Enemy\Ent=CreateCube()As you can see, the fields are always written with a backslash attached to the variable name. Now you have a first Entity. And it is already attached to a list inside your type. If you now create another one... Type TEnemy Field Ent% End Type ;1st Enemy.TEnemy = New TEnemy Enemy\Ent=CreateCube() ;2nd Enemy.TEnemy = New TEnemy Enemy\Ent=CreateCube()... you will have two entries in the list. you can recall all elements with For Enemy=Each TEnemy MoveEntity Enemy\Ent, 0, 0, 1 Next |
| ||
Hi Guys, I am having a little more success now.. Using the ARRAY method I "THINK" I have done it correctly, as it seems to work on the below code. I created 3 enemies.. Red Enemy...follows player if within a distance of 300 and > 40 Green Enemy.Follows player all the time constantly Blue Enemy..Follows either player or randomly generated "newpoint" whichever is closer. Bahhhh I am thinking I am using if and endif a bit too much as I notice there is a little CPU usage happening and the blocks are not fully ~smoothly~ moving... kinda laggy. I am hoping its ok if I ask how to accomplish something >>ONLY AFTER I TRY TO DO IT MY WAY"...lol and fail.. so you guys can see I am actually trying to learn and not get everything done for me. So.. at this point I can move, have basic AI (kinda), and can shoot ,,,my upcoming objectives will be to.. 1) Make some kind of gravity, so the player can jump and land back on the ground. 2) Make walls with collision for the AI to try and get thru to find the player 3) The hard one... I want to make my bullets... arrows. So they have an arc from the player into the air and stick into the ground... I am going to try and calculate the initial distance the arrow will travel from the player to the target.. work out the middle distance .. make that the peak of the arrow height.. and lastly using the gravity...make the arrow fall and stick into either the enemy, the wall or the ground. ... but I digress.. one step at a time :D Here is where I am up too.... Graphics3D 1024,768,32,2 SetBuffer BackBuffer() Global camera = CreateCamera () CameraZoom camera,1.6 CameraRange camera,.1,100000 CameraClsColor camera,0,0,0 PositionEntity camera,0,140,-800 light = CreateLight() PositionEntity light,0,0,0 AmbientLight 150,150,150 ;******************************************************* ; ARRAY ENEMY SETUP Dim enemy%(10) enemy(1)=CreateCube();create enemy number 1/10 as RED PositionEntity enemy(1), Rnd(-600,600), 0, Rnd(-300,300) ScaleEntity enemy(1),10,30,10 EntityColor enemy(1),255,0,0 enemy(2)=CreateCube();create enemy number 2/10 as GREEN PositionEntity enemy(2), Rnd(-600,600), 0, Rnd(-300,300) ScaleEntity enemy(2),10,30,10 EntityColor enemy(2),0,255,0 enemy(3)=CreateCube();create enemy number 3/10 as BLUE PositionEntity enemy(3), Rnd(-600,600), 0, Rnd(-300,300) ScaleEntity enemy(3),10,30,10 EntityColor enemy(3),0,0,255 ;******************************************************* player=CreateCube() PositionEntity player, 0, 0, -500 EntityColor player,100,100,100 ScaleEntity player,10,30,10 ;create newpoint GREEN pole for enemy to chase newpoint=CreateCube() xx=Rnd (800); then create new target point zz=Rnd (800) PositionEntity newpoint,xx,0,zz ScaleEntity newpoint,5,60,5 EntityColor newpoint,0,255,0 Plane=CreatePlane() EntityAlpha Plane,0.8 PlaneTexture=CreateTexture(128,128,9) ClsColor 0,0,255 Cls Color 255,255,255 Rect 0,0,64,64,1 Rect 64,64,64,64,1 CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(PlaneTexture) ScaleTexture PlaneTexture,40,40 EntityTexture Plane,PlaneTexture,0,0 Repeat ;EXISTING ENEMY MOVEMENT ;RED enemy Will start to follow if distance is less than 300, ans stop if <40 If enemy(1);exists If EntityDistance(enemy(1),player)<300 And EntityDistance(enemy(1),player)>40 PointEntity enemy(1), player ;enemy faces player MoveEntity enemy(1),0,0,Rnd(0,.5) EndIf EndIf ;GREEN enemy Will continue to follow player foerver without stopping If enemy(2);exists If EntityDistance(enemy(2),player)>40 PointEntity Enemy(2), player MoveEntity Enemy(2),0,0,Rnd(0,.6) EndIf EndIf ;BLUE enemy will move to either newpoint or player...depending whos closer If enemy(3);exists If EntityDistance(enemy(3),newpoint)< EntityDistance(enemy(3),player) PointEntity enemy(3), newpoint ;move towards newpoint MoveEntity enemy(3), 0, 0, Rnd( .5, .5 ) Else If EntityDistance(enemy(3),player)>40 PointEntity enemy(3), player ;move towards newpoint MoveEntity enemy(3), 0, 0, Rnd( .5, .5 ) EndIf EndIf EndIf ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;Generate random xx,zz co-ordinates for newpoint, for enemy to chase t=t+1 ;count timer If t>1000 ;if timer >1000 xx=Rnd (500) zz=Rnd (500) PositionEntity newpoint,xx,0,zz ;set down the target t=0 ;reset the timer EndIf ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;******************************************* If KeyDown(205) Then TurnEntity player,0,-.7,0 If KeyDown(203) Then TurnEntity player,0,0.7,0 If KeyDown(200) Then MoveEntity player,0,0,0.8 If KeyDown(208) Then MoveEntity player,0,0,-0.8 PositionEntity camera,0,60,-800 UpdateWorld RenderWorld Flip Forever |
| ||
You can use thousands of IFs, without getting in performance problems. To optimize performance you should use a FPS-Timer: Fps%=CreateTimer(60) ..... Repeat ...... UpdateWorld RenderWorld Flip 0 WaitTimer Fps Forever The combination of "60", "Flip 0" and the WaitTimer() command brings the best results. This also guarantees the same game speed over all computers. Adwise: Change "60" to "6" and you can observe your game in "slow motion". For better control fast things like arrows. Later, when it works perfect return to "60" Arrow movement? Try this: Flying object are constantly falling down from the beginning until the end of flight. But the x-Speed decreases from a high start level continuously downto 0. This means that within one TimeTick at the beginning Xadding is big (and Yadding is constant) and it looks like the arrow goes straight ahead. Later Xadding is very small. Now it look like the arrow is falling down. (check with slow motion) I see you use ARRAY now. But you are coding every enemey in seperate (but nearly same) code lines.... If you did understand ARRAY, you can use it again for the arrows. Create an array ARROW%(100) to be able to fire a lot of different arrow. But this time think about using FOR/NEXT with a counting i% instead of coding each single arrow! A last appeal: Please use the Forum codes to separate BlitzCode from text: [ code ]CreateTimer()...[ /code ] write this bracket tags with the word "code" before and "/code" after your code. But do not use SPACEs inside the tag. |
| ||
Raghhhh!!!... I had a Windows 10 Update, and that was what was messing up my PC and making me think the code was slow as it was actually stuttering. Of course I only found out when I shut down the PC last night... I ran it this morning perfectly. It's good to know about the FPS time code, I will use it from now on, and I will post all code in the Forum code format from now on. I am sorry for that, I didn't read about it as I should have but it won't happen again :P I was ~dreaming~ about code last night..weird hey.. I'm not good at it, but I did actually have some ideas on two things that were bugging me, and I will try them in when I get back from work tonight. :D Thanks again Midimaster, I'm guessing you are a great help to a lot of people. |