prinzbartu
prinzbartu
CC#
Created by prinzbartu on 1/6/2024 in #help
Encoding my game data files (Unity)
So I already made a GameData script with all my data being loaded and saved on a json file. But I want to encrypt them in a way, that is not easily changeable for everyone else. It doesnt have to be the best system, it should just not look like {Value: x} this is my code for my gamedata: https://pastebin.com/yUZ2zzXc Know that im completely new to encoding, so I have no clue what to do and how :)
5 replies
CC#
Created by prinzbartu on 12/18/2023 in #help
Getting a specific player input inbetween a specific time interval
Hi. Im currently trying to code a Volleyball game in unity. I have done basic movement and also the field setup, (its 2d) but what I dont manage is that I want the player to have to press specific button-combos in order to perform specific volleyball moves. So in this example, I want the player to first click "Q" and then choose one of WASD to choose what side hes gonna set the ball to. This is my code: private void Setting() { if (Input.GetKeyDown(KeyCode.Q) && Ball.transform.position.y > transform.position.y && Ball.transform.position.y < transform.position.y + 1) { rb.isKinematic = true; if (Input.GetKeyDown(KeyCode.W) && !Input.GetKeyDown(KeyCode.D)) { ballrb.AddForce(transform.up * 30); StartCoroutine(Wait()); rb.isKinematic = false; } else if (Input.GetKeyDown(KeyCode.D)) { ballrb.AddForce(transform.right * 30); StartCoroutine(Wait()); rb.isKinematic = false; } else if (Input.GetKeyDown(KeyCode.W) && Input.GetKeyDown(KeyCode.D)) { ballrb.AddForce(transform.right * 20); ballrb.AddForce(transform.up * 20); StartCoroutine(Wait()); rb.isKinematic = false; } } } Right now its the raw version without any timing tries, I didnt manage so I kept it like this. Could someone tell me how to modify it in order to make the player be able to have a little time window (say 1 second) to press the next button? Thanks!
1 replies