Computer Science Canada bullets and boundaires |
Author: | Marshmellow01 [ Tue Jun 05, 2007 11:45 pm ] | ||
Post subject: | bullets and boundaires | ||
I am not sure what i am doing wrong the bullets follow the same movements as the player and i tried to create bullets and manage to get two different ones ('m') this key is suppose to make player 1 shoot but it makes a circle that moves in the same direction as the player and only appears when you press the button, so it doesnt remain on the screen after pressing it ('l') this key shoots up but it shows a pillar and also moves with the player it seems more of a laser then a bullet the boundaires for top and bottem dont stop the player from going any further off the screen i am not sure what i am doing wrong and how to make the bullets work please help me out if u can ty , my project is due in two days copy and paste to a turing file if u want to see what i am trying to explain
Edited by Clayton: Keep the flourescent colours to a minimum please ![]() |
Author: | Mazer [ Wed Jun 06, 2007 1:03 pm ] |
Post subject: | RE:bullets and boundaires |
Your problem is that you're only drawing the bullet when m is pressed. You are short on time, and short on understanding. This probably wasn't a good choice for a project, but you've got to bear with it now. Simplify things by only allowing one bullet at a time. Represent this bullet with an x value, a y value, an x velocity, a y velocity, and whether the bullet is "live" or not. Start the bullet off as dead (false). When you're checking your fire button, check if the button is pressed AND if the bullet is dead. If that condition is true, set the bullet to live (true) and set the x and y to the player's position. Now give it a velocity depending on the direction the player is facing: if right, x velocity = 1, y velocity = 0; if up, x velocity = 0, y velocity = 1; etc. Use larger values if you want it moving faster. When you're drawing things, check if the bullet is live. If so, add the x velocity to the x position and the y velocity to the y position, then draw the bullet. You'll also want a counter or something for the bullet to see how long it's been alive. Make sure that counter is set to 0 when the bullet is created and incremented each time it's drawn. And get rid of that damned inner loop. |
Author: | Marshmellow01 [ Wed Jun 06, 2007 4:20 pm ] |
Post subject: | RE:bullets and boundaires |
eh XD im not rly sure how to do that .. total nub at this XD i looked on reference help thing var bulletx:int var bullety:int var bulletxvelocity :int var bulletyvelocity :int var dead : boolean := false var word : int for i : 1 .. 10 get word found := found or word = "gold" end for if live = true then put "Found 'gold' in the ten words" end if lol not rly sure how i am suppose to type it up ...i feel so hopeless XD |
Author: | Mazer [ Wed Jun 06, 2007 5:10 pm ] |
Post subject: | RE:bullets and boundaires |
I'll be blunt: you should feel hopeless. Really, what the hell does gold have to do with anything? I don't think you should've waited so long to work on this project, and I don't think you should've chosen a project as difficult as this if you have no idea what you're doing. Best of luck. |
Author: | Marshmellow01 [ Wed Jun 06, 2007 5:18 pm ] |
Post subject: | RE:bullets and boundaires |
lol XD it was on the turing refernec thing well ty for the help i guess lol i might just abandon it and start on a easier project that i can finish soon lol maybe pong or something well ty for the help i m just gona try to figure it out on my spare time then |