Jump to content
  • Advertisement

Search the Community

Showing results for tags 'Scripting'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Dev Loadout
  • Game Dev Unchained

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 35 results

  1. ShrimpAllergy

    C# C# Scripting: Help!

    Hello! I'm a student in a Game Design class, and I need help with a primitive game that's due tonight. It's my first time using vectors, Dot products, and 3D space. The object of the game is simply to sneak past the NPC and reach the goal without being spotted. I'm currently writing script for the NPC, which I intend to have a "cone" of vision, as well as a maximum visibility distance. I've worked out distance with relative ease, but I haven't figured out how to create a field of view for the NPC to spot the player within. I need help with a solution for this mechanic. I'm not intending for anyone to solve it for me, but I've hit a wall, and am at the point where I cannot complete this without asking for help. I'm building in Unity. Any feedback is GREATLY appreciated.
  2. Simply put, my function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size of the other), then the collision wouldn't be detected correctly; I would have to have them intersect for a collision to be registered rather than having it register when they are at least in direct contact, which is the intended behavior. Below is my code. local function DetectCollision(a, b) -- AABB to AABB local collisionX = (a.Position.X + a.Size.X) >= b.Position.X and (b.Position.X + b.Size.X) >= a.Position.X local collisionY = (a.Position.Y + a.Size.Y) >= b.Position.Y and (b.Position.Y + b.Size.Y) >= a.Position.Y local collisionZ = (a.Position.Z + a.Size.Z) >= b.Position.Z and (b.Position.Z + b.Size.Z) >= a.Position.Z return collisionX and collisionY and collisionZ end EDIT - To be more specific, the issues start to occur when I cut the size of one of the AABBs in half. For instance, if I had two cubes where one's size is 12 on all axes and the other is six on all axes, then the collision will not register. Upon debugging, I noticed that only one of the collision bools will become false. This seems to depend on what axis the smaller bounding box moves from in relation to the bigger one, so if I moved the smaller AABB away from the bigger one on the y-axis, then collisionY will be false.
  3. ggenije

    Make game like worms

    As said in title i want to make game like worms but i will some limits: 1.I can only draw terrarian using circles 2.Engine have very low performance -> only around 1000 circles allowed for normal fps of course in 2D
  4. Hello, i know this is the most random thing, but i need help, i am trying to make an idle game myself and publish it, but i am learning code by myself, and i am really lost, i got stuck with a null reference exception error when i was refering to variables and functions from another script and i have been stuck for hours the references work in start and update methods but not in the method i am trying to make for my buy button, i tried alot and alot, i think i spent over 7 hours trying to figure it out and whenever i asked anyone on any forrum who could help they refused and one said and i quote '' this is the simplest error you may as well leave game development'' and i really dont want to i am working against my circumstances and studying against what my parents want me to study( i am 17) i thought maybe you could relate and help, if you can help me please message me and ill send the code so you can maybe take a look at it, thank you.
  5. I am trying to communicate between 2 scripts that are in 2 different scenes. I start of in the home scene and than press a button that takes me into the main scene. When I go into the main scene I want a list of GameObjects to be disabled and another set of GameObjects to be enabled. - start off in the home scene- press a button that takes me to another scene (I can do this) - When I press button in home scene and enter main scene a list of gameobjects are disabled and another are enabled (struggling with this).
  6. Hello, I'm using the AngelScript SDK 2.32.0 that is listed on the AngelScript website as latest (http://www.angelcode.com/angelscript/downloads.html). I find that script copy constructors mentioned in the docs (http://www.angelcode.com/angelscript/sdk/docs/manual/doc_script_class_desc.html) are not called. I'm trying to use something like "engine->CreateScriptObjectCopy(m_obj, typeInfo);" to create a copy of script object with a copy constructor, but asSTypeBehaviour::copyconstruct is always null and the process defaults to regular construction and assignment. Even simple script only example like: Main() { TestClass arg; TestClass result = copyTest(arg); } class TestClass { TestClass() {} TestClass(const TestClass &in other) { Print("Hello World!"); } } TestClass copyTest(TestClass a) { return a; } Does not call the copy construction even once. Would anyone know if this is a known issue and was already solved in some beta build/commit before I go digging into the script parsing code to try fix it myself? Thanks
  7. Hello, I am designing my own game engine just as a hobby in c++. I like the language of c++ but for development speed for actually making a game with the engine i wish to use simple language like c# or python to script game objects. Can anyone point out any free online resources or link to forum posts that would help me understand how to enable my engine to use other languages to script with please. It would be very much appreciated. Thanks Alice
  8. ACTORS is a small framework explicitly built for Unit3d. It is used to ease the pain of decoupling data from behaviors without tons of boilerplate code. It relies on Unity3d scripting monobehavior concept but without unnecessary overhead. All game related entities are called Actors - they inherit from monobehavior and take role of container of data and behavior components. Like that : public class ActorPlayer : Actor, ITick { [FoldoutGroup("Setup")] public DataMove dataMove; protected override void Setup() { Add(dataMove); Add<BehaviorInput>(); } } [System.Serializable] public class DataMove : IData { public float x; public float y; public void Dispose() { } } public class BehaviorInput : Behavior, ITick { [Bind] private DataMove dataMove; public override void OnTick() { dataMove.x = Input.GetAxis("Horizontal"); dataMove.y = Input.GetAxis("Vertical"); } } The framework includes: Time management Custom Update Management. While Monobehavior update method can be used only with inherited mono components, you can use framework Update method in ANY script. public class MyCustomClass : ITick{ public MyCustomClass(){ ProcessingUpdate.Default.Add(this); } public void Tick(){ } } Object pooling both for game objects and plain c# objects Signal-event system Toolbox-singleton ( a simple servie locator ) Simple ECS for actors Unity additive scenes solution Blueprints - scriptable objects to define common actors data Extended tags system Timers for delayed action Timer.Add(0.75f, () => actor.tags.Remove(Tag.StateImmortal)); FoldGroup attribute to make your inspector look more organized: Bind attribute for lazy initialization of components inside of behaviors [Bind] private DataMove dataMove; Currently I'm working on documentation and example projects. I use framework in my working projects and always keep it updated.
  9. Hello Designer Community, we havent seen for a while but now, as I'm doing some more advanced game design again, I thought visiting you to get some feedback [deleted by moderator] As I'm in the design phase now need to think about what makes a kind of multiplayer/online/mmo RPG/whatever uses similar mechanics playable besides mob-farming/boss raids (if existing) or PvE, PvP; what makes even small Quests interesting. I now this has been asked a whole time but I decided to ask this again for the background of automated content creation as a desired result for the Spark ecosystem. What kind of quests or quest components could be generated too that are not listed below to make the game more interesting? Collect X of Y Carry X to Y (you maybe need to find X first) Kill X of Y Talk to X Kill X As I've played many hours of different RPG's (solo, online, mmo) there are always these five archetypes of core quests or core quest components that may sadly lead to just skipping the often more or less trivial storyline if existing just to raid through the quest for getting the XP and loot items. This isnt fun and even a good story (bad telled) may not keep the longterm gameplay experience very valuable. This may also be a bigger problem for auto generated quests so what should the generator also take into account to lead to an acceptable result?
  10. Website | Music | Youtube | IndieDB SCREENSHOTS What is it? Nanoforge , is a first-person, sci-fi sandbox-adventure game, built in Unity (C#). Target: Digital Distribution (Steam, Humble, etc.) What have we accomplished? Greenlit, and approved for distribution on Steam Detailed GDD, narrative, and gameplay documents (27000+ words) to make development simple Established code base: All of the basic gameplay mechanics are in place, and usable! We've developed custom tools to make the level creation and modular level design a snap! Proper management: We've successfully used project management tools since the project's inception, that allow us to complete tasks, communicate, and see the big picture. Modular from the start: We've developed custom tools to facilitate rapid creation of levels that are rich in detail! Perseverance: The game began (as a concept) in 2011, and has been in development since 2012, through multiple project management tools, programming languages, business models, and countless Skype calls. Detailed analytics: Every play session is tracked extensively via custom metrics, allowing us to view heatmaps of player movement, monitor enjoyment, and optimize the game to eliminate confusion Music/SFX: Over a dozen tracks posted on our Soundcloud page, as well as several custom SFX, made exclusively for the game. You can play it. Right now. Fully-functioning first-person sandbox gameplay, in fact. What do we offer? Credit in the game's credits, powerful portfolio pieces & references Welcoming and determined team members: Ever lost track of time and stayed up late creating art? We're like that. Flexibility: We've worked with team members from China, Italy, the U.K., Germany, Canada, the U.S., Poland, Russia, and Libya, in countless time-zones. We value your time, so we have no weekly hour requirement. Consistency: We've easily passed our two hundredeth sprint review/planning Skype call. Simple, efficient tools: In-house tools empower you to produce art that looks fantastic, whether in-game or on news sites. Industry experience: Many of our contributors have worked on major titles in the past, or have had professional development experience, including work on titles such as Deus Ex: Human Revolution, Prince of Persia,Thief, and Halo 2. Our former members have gone on to work on Forza Horizon, THIEF, and Crackdown 3. Minimal revisions required: We use a multi-stage process to minimize revisions to work, making development far more efficient! Presence at prominent game conventions, including PAX South, PlayOnCon, EGX Rezzed, and PAX East: We've showcased the game to YouTubers at these conventions and have received universally positive feedback. We are part of the 5%: Virtually all remote-work-based game projects fail within the first six months. We didn't. What do we need? C# Programmers C# experience required Prior experience with Unity a plus Communication skills Note: Other programmers, LEVEL DESIGNERS, and other roles are also invited to apply! JOIN NOW FREQUENTLY ASKED QUESTIONS Where's the gameplay footage? Just as AAA studios do, we keep our gameplay footage closely guarded, as it reveals our innovative take on sandbox gameplay. Additionally, releasing pre-release footage with non-final visuals could confuse potential players into believing that the footage is of the final version of the game. That said, here's a tiny look at our teleport effect. How does the game compare to games like GMod or Minecraft? We've surpassed Minecraft's Creative Mode in terms of functional features, and are closest to Garry's Mod in terms of planned feature set. I'm not experienced enough to join this project. That's not a question! There's always a place on our team for someone passionate about game development. Willing to learn? Any questions? Ask away!
  11. Happy Thursday! Looking for some recommendations for apps that help plan/organize classes and methods for a project (something like xmind but for programming). Also Looking for good app beyond GitHub for project coordination. Thanks in advance :3 ~Wolf
  12. Hi, I am new here, may I ask: do you guys have any suggestions about whether I should go to GDC, or Unity events during GDC, or, actually, any meetups and local events in LA, when I am more of a mature developer/when I already finish up most part of my game demo, or now? From career development perspective. Now I am not a total beginner, but I am not a mature developer either, kind of like in between X-0 Please forgive me if this question is silly or naive. Thank you!
  13. Hello there, I am a former player in the small, but dedicated community for the long dead MMO game Wind Slayer.I have been looking to play the game for 7 years, and just assumed that someone else would come along and create a private server. Since I've been waiting about 4 years since the last time I heard any discussion about a private server, I figured I'd have to do this myself.I have all of the game's files, I am looking for a team who would be willing to develop a private server. Already checked on the status of the game's IP and the developer (Hamelin) is a dead company, also; none of the former publishers (Outspark, and Ignited) exist either. So copyright concerns won't be an issue since the game isn't owned by any companies as of today.Link to the game's files for anyone who's interested: http://download.cnet.com/Windslayer/3000-7540_4-10857324.html (@Mods, I accidentally posted this before in the wrong section. Which is the reason for the double post. My apologies)
  14. I am having a problem with making duplicates of my AI. When one is within range, it performs normally. If two are in range, then they both freeze up. The AI are direct duplicates of each other. I don't know what causes this. Code below: Any help is seriously appreciated. Thank you. Code Below: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class NavMeshAI : MonoBehaviour { public Transform player; public Transform head; public Animator anim; public bool pursuing = false; public NavMeshAgent navComponent; public Transform enemy; // Use this for initialization void Start () { anim = GetComponent<Animator> (); navComponent = this.gameObject.GetComponent<NavMeshAgent>(); } // Update is called once per frame void Update () { Vector3 direction = player.position - this.transform.position; direction.y = 0; float angle = Vector3.Angle (direction, head.up); if (Vector3.Distance (player.position, this.transform.position) < 10 && (angle < 360 || pursuing)) { pursuing = true; this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRotation (direction), 0.1f); anim.SetBool ("isIdle", false); if (direction.magnitude > 2) { this.transform.Translate (0, 0, 0.05f); anim.SetBool ("isWalking", true); anim.SetBool ("isAttacking", false); if (pursuing == true) { navComponent.SetDestination (player.position); } } else { anim.SetBool ("isAttacking", true); anim.SetBool ("isWalking", false); } } else { anim.SetBool ("isIdle", true); anim.SetBool ("isWalking", false); anim.SetBool ("isAttacking", false); pursuing = false; navComponent.SetDestination (enemy.position); } }
  15. Hi All, Im running through some video tutorials in C# as im newbie. One thing im doing is adding lots of comments to the code so I can go back and revisit the code later and know exacly what is going on. What id also like to do is store the code snippets in an easy to find place so I can reuse/analyse them later. I kind of just want a long scrolling page with all my code and commented snippets on that I can use as reference later which also maintains the snippet format and is of course searchable. There seems to be a few apps as well as Git Hub etc to store code snippets but im just wondering which one from a newbie perspective works best for you and why? Kind Regards, John
  16. ccuccherini

    Random Number Generator

    I'm running to some issues with a random number generator that I am trying to create to test what type of attack an enemy will use (weapon or magic) and whether or not they land a hit with the attack. What I want it to do is generate a random number number for the type of attack, then generate a separate random number for if the hit lands or not. What actually happens is it is generating a different number each iteration, but the same number for each item. So for instance, if the random number is a 6, both attack type and if it hit is a 6, if it's a 7 both are 7, etc. I'm almost certain the issue is within how I'm using time in conjunction with this, but everything else I've found hasn't been helpful. I've tried doing one function, but had the same issue and switched to two functions in the hopes that would help, but it didn't and now I'm not quite sure what to try next. Here is the code I have so far: // Example program #include <iostream> #include <string> #include <stdlib.h> #include <ctime> using namespace std; int getRandAttack(); int getRandHit(); int main() { int randomAttack; int randomHit; randomAttack = getRandAttack(); cout<<randomAttack<<endl; //used to ensure same number isn't given every time //decides what happens based on what number was given if (randomAttack <= 5) { cout<<"Enemy used a weapon!"<<endl; }else if (randomAttack > 5) { cout<<"Enemy used magic!"<<endl; } randomHit = getRandHit(); cout<<randomHit<<endl; //used to ensure same number isn't given every time //decides what happens based on what number was given if (randomHit <= 5) { cout<<"The attack missed!"; }else if (randomHit > 5) { cout<<"The attack hit!"; } } //gets random number to determine enemy attack type int getRandAttack () { int random; srand (time(NULL)); random = rand() % 10 + 1; return random; } //gets random number to determine if enemy attack lands a hit int getRandHit () { int random; srand (time(NULL)); random = rand() % 10 + 1; return random; } I know there is an easier way to do this that involves classes, but the online compiler I'm messing around with right now doesn't seem to support extra files, so I'm making functions work instead. Any help and lead in the right direction would be greatly appreciated.
  17. Looking for a team to work on game development. About Me: I currently work in Web Development, primarily PHP, JS, and SQL, with some front-end work. Previously was into Game Dev but no paid jobs, just projects such as Renegade Medieval, and some community assets in Dota2. Developer Dabbled in Unity (low to medium experience with C#, it's similar to Java which I've used more of) Basic coding in GameMaker, similar to JavaScript, but didn't get much further than HeartBeast tutorials Some level design in Unreal Engine (also managed to get a character rigged and in, but that was years ago) Artist 3D modelling, primarily characters, high poly sculpting to low poly retopology, unwrapping, and baking 2D pixel art, and textures (not much in terms of 2D concept art though) You can see some of the stuff I do here. Requirements: Looking for a team with an established concept and development already underway. I'd like to see some examples and game engine progress before dedicating time to assets / characters. Communicative team Ideally a team working on just the one project Flexible working hours, I won't be able to give a great deal of time And that's it really. If you could include information in the comments below, or PMs that would be great.
  18. Hello! I'm not sure if this is the right place since i'm new to the forums. I'm creating a simple "City creator" right now, and, obviously, i need to create a Road tool for it. I was planning on doing raytracing to make the road snap to the terrain geometry, but it would clip through the terrain in places with mountains or different heights. I don't want to make a simple 2D decal because it would not look good without shape(The sidewalk is of course going to be taller and have a different geometry than the road itself) and i want to make it "bendable". I'm not the best at maths and geometry manipulation so i don't know where to start... I'm using Unity by the way, and sorry for my bad English!
  19. KARTHI

    Need help with makehuman

    Currently I using makehuman to make a 3d models but I am not satisfied with that model. If any use this please reply about the quality and details of models. 🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
  20. 'lo again all. I mentioned in my previous entry that I've been porting our 2009 release, Static: Investigator Training which is a C++/Direct3D/lua fmv horror adventure; to html5/js (canvas) using the base code from 96Mill and Revel Immortal as a starting point. The process has been going well, however there have been some sticky spots. extracting the original data from binary files atlasing approximately 300mb of png compressed graphics mimicking synchronous co-routine functions lua provided in JS differences between the original engine and the new engine re-re-remembering that everything takes way longer than you think it will I attacked what I thought would be the hardest problem first, which was extracting the original binary data. There were two forms of binary file classes.bin and game.bin; where classes.bin represented the data classes or 'templates' that described static, shared (by flyweight pattern) attributes for all three object types; game, rooms and actors. ...and where game.bin was in the exact form of a save-game, that represented a new-game initial state. That is representing the actual objects, their relationships (game has rooms, room has actors), starting attributes (position, animation, alpha, etc.) I used NodeJS to parse both of these files and export json equivalents of each file for easy access of data; I also took this opportunity to have computer assistance for renaming/transforming members to better match what the new engine would expect. Next I began to import the existing resources, which involved preparing them for a lot of atlasing Audio was simple, save for the shear amount of it; when starting a new HTML5 project; you always take size and amount of resources into consideration; it's like climbing Everest (not that I ever have) but everything you include needs to be downloaded by the user who is expecting a snappy game on their probably outdated tablet ...so you're careful. I didn't have any such luxury in the port, the final sound effect atlas came to 10 minutes; which should be fine. ...thankfully voice files are not atlased, as there is over 500 of them. In addition to atlasing, all of this data must be trans-coded as well, from source formats such as .wav, to deployment formats of .ogg and .mp3 ...why both? because depending on which device/browser/version you encounter some are only capable of running one or the other ...and some which are capable of playing both, are better at playing one than another ...and some devices outright lie. But this has gotten better over the years.
  21. Just a little progress video. As well as getting the scripting working a bit more, I've been placing villages and naming map areas. The area names are generated by putting together random chosen syllables. Morphing For variation with the natives they now use realtime bones like the player, and there is a morphing system so you can have fat / thin / muscular natives etc (I only have created fat and thin so far to test, but it works fine). UV Maps As well as the morphing variation, each native has a uv map so it can use different textures for different uv islands (parts of the body). This will allow e.g. wearing different clothing, different faces, jewellry etc. At the moment I've just just put some red green and blue and white over the different areas as placeholder until I create more textures. The conversations are all random from script just for a test .. choosing random animals and people to make random snippets of talk. I will probably make this more purposeful, giving each villager names and relations so they can further the plot. Next Next up I am putting in attachments so they can carry spears etc, and the player can carry sword. Also I may be able to have a canoe as an attachment off the root nodes so they can canoe on the lakes. I will also add female natives. I could do them as morphs, but I think it will be easier for texturing etc to have a different female model.
  22. dell96

    Help please !!!

    Hi there I'm new to unity and C# and i want to make my first Android game and I'm having a problem when my player collides with the cratepipe in the game the spawning crate wont stop i need help with this i want to stop the spawning when the gameobject "player" hits the crates and stop. my player move by tilting I'm going to leave all the scripts I'm using so far please help me what should i do....? The Countdown Script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CountdownText : MonoBehaviour { public delegate void CountdownFinished(); public static event CountdownFinished OnCountdownFinished; Text countdown; void OnEnable() { countdown = GetComponent<Text>(); countdown.text = "3"; StartCoroutine("Countdown"); } IEnumerator Countdown() { int count = 3; for (int i = 0; i < count; i++) { countdown.text = (count - i).ToString(); yield return new WaitForSeconds(1); } OnCountdownFinished(); } } Crate Script sing UnityEngine; public class Crate : MonoBehaviour { public bool hit = false; void OnTriggerEntre2D(Collider2D collider) { if (collider.tag =="Player") { hit = true; } } } CrateSpawn Script using System.Collections; using System.Collections.Generic; using UnityEngine; public class CrateSpawn : MonoBehaviour { List<Cratework> cratePool; int index = -1; public GameObject cratePrefab; public float spawnTime = 4f; public float speed = 35; public int poolSize = 5; public bool isRunning = true; [HideInInspector] public bool hit = false; void Start() { cratePool = new List<Cratework>(); for (int i = 0; i < poolSize; i++) { var crate = (GameObject)Instantiate(cratePrefab, new Vector3(0, 8, 0), Quaternion.identity); cratePool.Add(crate.GetComponent<Cratework>()); } StartCoroutine(SpawnCrate()); } void Update() { for (int i = 0; i <= poolSize; i++) { var crate = cratePool; crate.transform.position += new Vector3(0, speed * Time.deltaTime, 0); if (crate.hit) { hit = true; StopAllCoroutines(SpawnCrate()); } } } IEnumerator SpawnCrate() { while (isRunning) { index++; index %= poolSize; var crate = cratePool[index]; float x = Random.Range(-2, 2); crate.transform.position = new Vector3(x, -6, 0); yield return new WaitForSeconds(spawnTime); } } } CrateWork Script using UnityEngine; public class Cratework : MonoBehaviour { public Crate left; public Crate right; public bool hit = false; void Update () { if (left.hit || right.hit) { hit = true; } } } GameController Script using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameController : MonoBehaviour { public CrateSpawn crateSpawn; void ChangeSpeed(float speed) { crateSpawn.speed = speed; } void Update() { if (crateSpawn.hit) { ChangeSpeed(0); } } } GameManager Script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameManager : MonoBehaviour { public delegate void GameDelegate(); public static event GameDelegate OnGameStarted; public static event GameDelegate OnGameOverConfirmed; public static GameManager Instance; public GameObject startPage; public GameObject gameOverPage; public GameObject countdownPage; public Text scoreText; enum PageState { None, Start, GameOver, Countdown } int score = 0; bool gameover = true; public bool GameOver { get { return gameover; } } void Awake() { Instance = this; } void OnEnable() { CountdownText.OnCountdownFinished += OnCountdownFinished; MoveController.OnPlayerDied += OnPlayerDied; MoveController.OnPlayerScored += OnPlayerScored; } void OnDisable() { CountdownText.OnCountdownFinished -= OnCountdownFinished; MoveController.OnPlayerDied -= OnPlayerDied; MoveController.OnPlayerScored -= OnPlayerScored; } void OnCountdownFinished() { SetPageState(PageState.None); OnGameStarted(); score = 0; gameover = false; } void OnPlayerDied() { gameover = true; int savedScore = PlayerPrefs.GetInt("HighScore"); if (score > savedScore) { PlayerPrefs.SetInt("HighScore", score); } SetPageState(PageState.GameOver); } void OnPlayerScored() { score++; scoreText.text = score.ToString(); } void SetPageState(PageState state) { switch (state) { case PageState.None: startPage.SetActive(false); gameOverPage.SetActive(false); countdownPage.SetActive(false); break; case PageState.Start: startPage.SetActive(true); gameOverPage.SetActive(false); countdownPage.SetActive(false); break; case PageState.GameOver: startPage.SetActive(false); gameOverPage.SetActive(true); countdownPage.SetActive(false); break; case PageState.Countdown: startPage.SetActive(false); gameOverPage.SetActive(false); countdownPage.SetActive(true); break; } } public void ConfirmGameOver() { OnGameOverConfirmed();//event scoreText.text = "0"; SetPageState(PageState.Start); } public void StartGame() { SetPageState(PageState.Countdown); } } HighScore Script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class HighscoreText : MonoBehaviour { Text highscore; void OnEnable() { highscore = GetComponent<Text>(); highscore.text = ": " + PlayerPrefs.GetInt("HighScore").ToString(); } } MoveController Script using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoveController : MonoBehaviour { public delegate void PlayerDelegate(); public static event PlayerDelegate OnPlayerDied; public static event PlayerDelegate OnPlayerScored; public float speed = 0.25f; public Vector3 startPos; Rigidbody2D rigidbody; GameManager game; void Start() { rigidbody = GetComponent<Rigidbody2D>(); game = GameManager.Instance; } void OnEnable() { GameManager.OnGameStarted += OnGameStarted; GameManager.OnGameOverConfirmed += OnGameOverConfirmed; } void OnDisable() { GameManager.OnGameStarted -= OnGameStarted; GameManager.OnGameOverConfirmed -= OnGameOverConfirmed; } void OnGameStarted() { rigidbody.velocity = Vector3.zero; rigidbody.simulated = true; } void OnGameOverConfirmed() { transform.localPosition = startPos; } void Update() { transform.Translate(Input.acceleration.x * speed, 0, 0); } void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "ScoreZone") { OnPlayerScored(); //play a sound //get a point } if (col.gameObject.tag == "DeadZone") { OnPlayerDied(); rigidbody.simulated = false; } } }
  23. Hey , I wanted to combine some ideas of the Actor model with an Entity Component model and wanted to see if anyone had any experience using the actor model for gameplay and if they could present the pros and cons of using such a method. I know that a pro is that it helps with concurrency , but I can see a major con being the allocation of messages for communication between. I've built a code generation tool that can automatically generate messages based on c++ function definitions, so creating a class per message would not be a problem. Thank you!
  24. BioBoss

    Java game from 1998

    I play this game called graal classic and recently i decided to look into the history of it. eventually i came across this link of way older versions of they game, problem is i dont know how to run any of them. does anyone here know how i can emulate them?
  25. Hello everyone I have made a tutorial on creating a hitman style game in unity. If you think that will be of any interest to you. Please check the link.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!