Shooting a projectile from a player
Posted: Fri Jun 29, 2012 3:17 pm
Hey all first off I'm new here and wanted to start off by saying that...hi I'm new. Never programmed a game before and Love2D seemed like one of my best options to get my feet wet. I do have programming experience (Basic Java course and C# in school) and am a Web Developer/Designer (so coding somewhat comes easy to me)
With that being said I'm new to Lua (which I'm liking a lot) and obviously Love. Lets jump into it:
I want to start basic and just make that typical flying game where you fly around and shoot shit at people. I followed a few tutorials and was able to come up with a start screen, player with controls, and a few other things. Now I need help creating the projectile and having the player shoot it when a key is pressed.
I remember from using Unity that to shoot a projectile we had to make it appear using the players height and width. So I created a new file for my projectile where I'm trying to set the basic properties. I know I would need to check if the "space key" is pressed for when to shoot the projectile - but how would I exactly finish this up? I'm kind of lost on how to determine EXACTLY where to shoot the project from based on my player, how to call it and implement it (IE: I have the projectile created, but how do I USE it) - Obviously it will have to be create WHEN the space key is pressed and executed (right?) So my function to draw the projectile will need to execute IF the space key is pressed?
If any of that made sense, I need some help! I included my LOVE files if anyone can help!
With that being said I'm new to Lua (which I'm liking a lot) and obviously Love. Lets jump into it:
I want to start basic and just make that typical flying game where you fly around and shoot shit at people. I followed a few tutorials and was able to come up with a start screen, player with controls, and a few other things. Now I need help creating the projectile and having the player shoot it when a key is pressed.
I remember from using Unity that to shoot a projectile we had to make it appear using the players height and width. So I created a new file for my projectile where I'm trying to set the basic properties. I know I would need to check if the "space key" is pressed for when to shoot the projectile - but how would I exactly finish this up? I'm kind of lost on how to determine EXACTLY where to shoot the project from based on my player, how to call it and implement it (IE: I have the projectile created, but how do I USE it) - Obviously it will have to be create WHEN the space key is pressed and executed (right?) So my function to draw the projectile will need to execute IF the space key is pressed?
If any of that made sense, I need some help! I included my LOVE files if anyone can help!