Jump to content

Recommended Posts

Posted

image.thumb.png.e1abd175326ebffff380e62fc9a783a3.png

 

This is a small project, to create a simple car system to sell to whoever is interested.

And some of the content from my Spanish-language Leadwerks website.

  • Like 2

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted

image.thumb.png.6f3280a0fb422d445e02411706da0f7c.png

 

--#*********************************************************
--# Proyecto    	:  	Sistema Vehiculo.					
--# Programador 	:  	Yue Rexie.							
--# Sitio Web		:  	http://www.iris3dgames.ga			
--# Nombre Fichero 	:  	Jeep.lua							
--#*********************************************************
--# Obervaciones 	:  	Fichero enganchado a una entidad	
--#					 	Jeep (Malla)						
--#*********************************************************
-- Clases.
import("Scripts/Vehiculo/Clases/vehiculo.lua")

-- Suspención.
--***************
-- Ejes traseros.
Script.ejeAmT1 	= nil --entity "Eje T1"
Script.ejeAmT2 	= nil --entity "Eje T2"

-- Ejes delanteros.
Script.ejeAmF1 	= nil --entity "Eje F1"
Script.ejeAmF2 	= nil --entity "Eje F2"

-- Ejes Dirección llantas delanteras.
Script.ejeDir1 	= nil --entity "Eje DF1"
Script.ejeDir2  = nil --entity "Eje DF2"

-- Llantas Traseras.
Script.llantaT1 = nil --entity "Rueda T1"
Script.llantaT2 = nil --entity "Rueda T2"

-- Llantas Delanteras.
Script.llantaF1 = nil --entity "Rueda F1"
Script.llantaF2 = nil --entity "Rueda F2"

	
function Script:Start()


	-- Se crea el objeto jeep.
	jeep = vehiculo:New()
	
	-- Se crean los amortiguadores traseros.
	jeep:InitSusp(self.ejeAmT1,self.entity)
	jeep:InitSusp(self.ejeAmT2,self.entity)
	-- Se crean los amortiguadores delanteros.
	jeep:InitSusp(self.ejeAmF1,self.entity)
	jeep:InitSusp(self.ejeAmF2,self.entity)

	-- Se crea los motores ruedas Traseras.
	jeep:InitMotorRuedas( self.llantaT1, self.ejeAmT1)
	jeep:InitMotorRuedas( self.llantaT2, self.ejeAmT2)

	-- Se crea los motores ruedas Delanteras.
	jeep:InitMotorRuedas( self.llantaF1, self.ejeDir1 )
	jeep:InitMotorRuedas( self.llantaF2, self.ejeDir2 )

	-- Se crea los motores de dirección de las llantas frontales.
	jeep:InitMotorDir( self.ejeDir1, self.ejeAmF1)
	jeep:InitMotorDir( self.ejeDir2, self.ejeAmF2)



end


function Script:UpdateWorld()
	--self.suspT0:EnableMotor()
	local ventana = Window:GetCurrent()


	if ventana:KeyDown(Key.J) then
		self.entity:AddForce(0,25000,0)
		
	end

end

 

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted

Progress is evident, trial and error, this in the end tires, but I have learned new things. I don't think I'll ever play a game, but the little things I do are like filling out a crossword puzzle.

MY car would never work, because I made it very big and as a measure now I have the height of character controller.

 

-- Pivots Springs.
Script.pSpring1 = nil --entity "Pivot Spring 1 :"
Script.pSpring2 = nil --entity "Pivot Spring 2 :"
Script.pSpring3 = nil --entity "Pivot Spring 3 :"
Script.pSpring4 = nil --entity "Pivot Spring 4 :"
-- Mesh Wheels.
Script.mWheel1  = nil --entity "Mesh Wheel 1 :"
Script.mWheel2  = nil --entity "Mesh Wheel 2 :"
Script.mWheel3  = nil --entity "Mesh Wheel 3 :"
Script.mWheel4  = nil --entity "Mesh Wheel 4 :"

-- Classes.
import("Scripts/Vehicle/Classes/vehicle.lua")

vel = 10
function Script:Start()



	self.jeep = vehicle.New()
	-- Springs.
	self.jeep:CreateSpring( self.pSpring1, self.entity )
	self.jeep:CreateSpring( self.pSpring2, self.entity )
	self.jeep:CreateSpring( self.pSpring3, self.entity )
	self.jeep:CreateSpring( self.pSpring4, self.entity )

	-- Weels.
	self.llanta1 = self.jeep:CreateWheel( self.pSpring1, self.mWheel1 )
	self.llanta2 = self.jeep:CreateWheel( self.pSpring2, self.mWheel2 )
	self.llanta3 = self.jeep:CreateWheel( self.pSpring3, self.mWheel3 )
	self.llanta4 = self.jeep:CreateWheel( self.pSpring4, self.mWheel4 )
	
end

local vel = 0
function Script:UpdateWorld()

	if Window:GetCurrent():KeyDown(Key.J) then
		self.entity:AddForce(0,500*6,0)
	end

	
	
	if Window:GetCurrent():KeyDown(Key.X) then
		self.llanta1:SetAngle(self.llanta1:GetAngle() - 100 )
		self.llanta2:SetAngle(self.llanta2:GetAngle() - 100 )
		self.llanta3:SetAngle(self.llanta1:GetAngle() - 100 )
		self.llanta4:SetAngle(self.llanta1:GetAngle() - 100 )

		if vel < 2000 then
			 vel = vel + 10
		end
	else 
		
		vel = 0


	end
	



	self.llanta1:SetMotorSpeed(vel)
	self.llanta2:SetMotorSpeed(vel)
	self.llanta3:SetMotorSpeed(vel)
	self.llanta4:SetMotorSpeed(vel)

	System:Print(vel)


end


 

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...