Hey guys, I’m a college student working on a group project. We are creating a game similar to gradius or life force. The team decided to use a HUD because they want to move the game into an iphone/android console. (using mouse click for now)
Right now I have created a playable demo using the keyboard buttons. The player can move up and down, shoot enemy ships, die, pause, sound, and even maintain a highscore. The problem I am having is that I want the player to be able to click the HUD Up button that I created to move up, the same for the Down button. Unfortunately I am running into many errors in my coding, I am still learning.
I imagine it would be somewhere along the lines of using:
void OnMouseDown()
{
???
}
I have a fully functional pause button that can be clicked, but I just can’t seem to get the code for movement right. Any help or maybe a tutorial reference?
Is it a GUI Button? Or is it a GUI Texture? What is it?
If you can tell me what it is I can help…
But you could use a bool called isPaused and change that value when you pause it… make all movement reliant on it in an if statement so that nothing happens when it is true
Yes, it is a GUI. I am using the TK 2D Button script on a TK 2D Sprite.
For example, this is my pause button that I created. But I am trying to make it so I click a button on the screen, and it will move the player’s object vertically up. Similarly, a down button to be clicked to send him down vertically.
using UnityEngine;
using System.Collections;
public class PauseTest : MonoBehaviour
{
private Rect windowRect;
bool paused = true;