Jump to content

CoolBeans

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by CoolBeans

  1. Ok so I'm trying to learn some of the crazy ball game Josh posted. I know there will be some material he is going to make for it in the future release of Leadwerks but I couldn't help but to try and get started on my own. Wasn't the exact game Id like to make but I see some mechanics I may be able to apply and learn here form prior tutorials. Ive got the ball and camera working. Here is the script some it I found here in a post. Script.camera = "" --entity "Camera" Script.soundfile1=""--path "Sound 1" "Wac file (*.wav):wav|Sound" Script.soundfile2=""--path "Sound 2" "Wac file (*.wav):wav|Sound" Script.soundfile3=""--path "Sound 3" "Wac file (*.wav):wav|Sound" Script.soundfile4=""--path "Sound 4" "Wac file (*.wav):wav|Sound" Script.threshhold=2--float "Threshhold" Script.maxfrequency=300--minimum delay between sound plays Script.range=20--float "Range" --Global values ImpactNoiseLastSoundTime=0-- This will be shared among all instances of this script and ensure we don't play too many sounds function Script:UpdateWorld() local window = Window:GetCurrent() if window:KeyDown(Key.W) then self.entity:AddForce(0,0,10,true) end if window:KeyDown(Key.S) then self.entity:AddForce(0,0,-10,true) end if window:KeyDown(Key.A) then self.entity:AddForce(-10,0,0,true) end if window:KeyDown(Key.D) then self.entity:AddForce(10,0,0,true) end if window:KeyHit(Key.Space) then self.entity:AddForce(0,300,0,true) end self.camera:SetPosition(self.entity:GetPosition(true) + Vec3(0,3,-6)) end function Script:Start() self.sound={} for n=1,4 do local filepath = self["soundfile"..tostring(n)] if filepath~="" then local noise = Sound:Load(filepath) if noise~=nil then table.insert(self.sound,noise) --self.sound[#self.sound+1]=noise end end end end function Script:Collision(entity, position, normal, speed) if speed>self.threshhold then if #self.sound>0 then local collisiontype = entity:GetCollisionType() if collisiontype==Collision.Prop or collisiontype==Collision.Scene then local t = Time:GetCurrent() if t-ImpactNoiseLastSoundTime>self.maxfrequency then ImpactNoiseLastSoundTime=t local n=math.random(#self.sound) local noise = self.sound[n] self.entity:EmitSound(noise,self.range) end end end end end Brings me to my first question. Where is the default camera when you make a scene? When I create a camera its always camera 2 so I presume a default cam is always added and hidden from scene objects list? First problem I'm dealing with is ball creation. Its never perfectly round. When rolling around the ball it skips and makes sounds of course. In 3dmax u can scale an object uniform on xyz at the same time. I cant seem to do that in Leadwerks? Ive tried grid snap and no grid snap always a ball that wobbles. Well its a stone ball for now so its ok lol. Seriously why? Second Ive kinda set up what Josh has initially in the game. 2 blades spinning opposite. When my ball is in motion it reacts fine to the blades. Makes sound, get forced away etc. But.. When the ball is idle the blades go right thru the ball like its not there instead of applying force/movement. I have played with different prop types, mass and what not and have got some crazy results ranging from... Ball falls thru platform, ball hits blade, blade moves and still spins till blade goes crazy off the map. Blade just spins weird from the get go or falls itself. I have the ball set - Rigid body, sphere get shape fit physics, mass 1.0, collision prop nothing checked marked after. As for the rotating blades ive tries all combo's I can conjure and have not found the right one. I can't make a screen shot of the game running via print screen is there a Leadwerks feature for that? After this point Im going to try and apply the death trigger script from Jorn's tutorial if the balls falls off. If I get this far I know the next step will be wanting to learn the count meter to start, how to collect the objects and count them in the score ect if anyone can provide any links/material for this dirrection would be awesome, thanks a lot for any help.
  2. Can anyone help with the above question? Also I have a rotating block to navigate my ball around. If my ball is already rolling everything reacts right. I hit the rotating block and it forces me to move etc but... If my ball is standing still/idle the rotating box goes right thru my ball as if its not there. Ive messed with settings and mass and what not and can't find a working combo. Lastly do I really need to make a sphere in 3dsmax and import into Leadwerks because I can NOT get a perfectly round ball no matter what I try in Leadwerks am I missing something so simple? How do you scale object on all xyz at the same time? In 3dmax you grab where the x.y.z meet. I I hope someone can comment so I can progress soon. Edit I have the same ball settings as illustrated above. Must be the box setting. There is no collision if the ball is NOT in motion, odd. Off to tinker some more. Edit Tried all settings/combinations arrrrrrr!
  3. Got this to work cool. One problem you can keep jumping the ball even in the air. I presume this line of code prevents that. if self.entity collision(world) then jump=true :end Of course its not right Ive fiddled around how to properly add it in? Script.camera = "" --entity "Camera" function Script:UpdateWorld() local window = Window:GetCurrent() if window:KeyDown(Key.W) then self.entity:AddForce(0,0,10,true) end if window:KeyDown(Key.S) then self.entity:AddForce(0,0,-10,true) end if window:KeyDown(Key.A) then self.entity:AddForce(-10,0,0,true) end if window:KeyDown(Key.D) then self.entity:AddForce(10,0,0,true) end if window:KeyHit(Key.Space) then self.entity:AddForce(0,500,0,true) end self.camera:SetPosition(self.entity:GetPosition(true) + Vec3(0,1,-5)) end Thanks. CB
  4. Resolved as decribed on the steam topic. Sorry about this mess the charater controller script I saved over from another project. I know genius right? This topic can be binned. Thanks.
  5. FPS Weapons Map Ive started a thread on steam and have been asked to post the file here. Its an unaltered map file that comes from the steam DLC. So everyone should have the same file I would think. Anyways I load the map and the prefabs I believe are there but I can't pickup or use any of the weapons. Ive posted a screen cap. Now if Im suppose to do something other than load the map file then that would be the problem. Thanks for help Id like to move forward with these included FPS mechanics FPSWeapons.rar
×
×
  • Create New...