mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2024-12-18 21:44:51 +01:00
feat: add particles on player if it is not jumping (#25)
This commit is contained in:
parent
27a16dcef7
commit
a7c19a6549
@ -147,7 +147,8 @@ TextureImporter:
|
|||||||
secondaryTextures: []
|
secondaryTextures: []
|
||||||
spriteCustomMetadata:
|
spriteCustomMetadata:
|
||||||
entries: []
|
entries: []
|
||||||
nameFileIdTable: {}
|
nameFileIdTable:
|
||||||
|
BaseScene_0: -2257217325195158302
|
||||||
mipmapLimitGroupName:
|
mipmapLimitGroupName:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
userData:
|
userData:
|
||||||
|
@ -172,7 +172,9 @@ TextureImporter:
|
|||||||
secondaryTextures: []
|
secondaryTextures: []
|
||||||
spriteCustomMetadata:
|
spriteCustomMetadata:
|
||||||
entries: []
|
entries: []
|
||||||
nameFileIdTable: {}
|
nameFileIdTable:
|
||||||
|
BaseSpike_0: -7710779685713120251
|
||||||
|
BaseSpike_1: 978792226429369126
|
||||||
mipmapLimitGroupName:
|
mipmapLimitGroupName:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
userData:
|
userData:
|
||||||
|
@ -147,7 +147,8 @@ TextureImporter:
|
|||||||
secondaryTextures: []
|
secondaryTextures: []
|
||||||
spriteCustomMetadata:
|
spriteCustomMetadata:
|
||||||
entries: []
|
entries: []
|
||||||
nameFileIdTable: {}
|
nameFileIdTable:
|
||||||
|
BaseSquare_0: -5986989983176976689
|
||||||
mipmapLimitGroupName:
|
mipmapLimitGroupName:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
userData:
|
userData:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,26 +7,54 @@ public class PlayerScript : MonoBehaviour
|
|||||||
|
|
||||||
public Vector3 initialPosition;
|
public Vector3 initialPosition;
|
||||||
|
|
||||||
|
public ParticleSystem particleSystem;
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
initialPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);
|
initialPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);
|
||||||
|
|
||||||
|
var mainModule = particleSystem.main;
|
||||||
|
mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
|
||||||
|
|
||||||
|
particleSystem.transform.parent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
transform.position += Time.deltaTime * 8.6f * Vector3.right;
|
transform.position += Time.deltaTime * 8.6f * Vector3.right;
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Space))
|
if (!IsJumping())
|
||||||
{
|
{
|
||||||
if (!IsJumping())
|
Vector3 Rotation = transform.rotation.eulerAngles;
|
||||||
|
Rotation.z = Mathf.Round(Rotation.z / 90) * 90;
|
||||||
|
transform.rotation = Quaternion.Euler(Rotation);
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.Space))
|
||||||
{
|
{
|
||||||
rigidBody.AddForce(Vector2.up * 26.6581f, ForceMode2D.Impulse);
|
rigidBody.AddForce(Vector2.up * 26.6581f, ForceMode2D.Impulse);
|
||||||
}
|
}
|
||||||
|
particleSystem.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
particleSystem.gameObject.SetActive(false);
|
||||||
|
transform.Rotate(Vector3.back * 360 * Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
particleSystem.transform.position = transform.position + new Vector3(-0.19f, -0.64f, 0);
|
||||||
|
particleSystem.transform.rotation = Quaternion.Euler(0, 0, 150.464f);
|
||||||
|
|
||||||
|
ParticleSystemSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsJumping()
|
private bool IsJumping()
|
||||||
{
|
{
|
||||||
return Mathf.Abs(initialPosition.y - transform.position.y) > 0.05f;
|
return Mathf.Abs(initialPosition.y - transform.position.y) > 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ParticleSystemSpeed()
|
||||||
|
{
|
||||||
|
var velocityOverLifetime = particleSystem.velocityOverLifetime;
|
||||||
|
velocityOverLifetime.x = rigidBody.linearVelocity.x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user