I am using scratch. I am cloning sprites and I am making a minecraft type game where I use many clones of one block to make the workload easier. I keep the original sprite hidden, and hide clones when I want to destroy them. I am trying to create new clones by moving the original sprite to the location where I want the clone, cloning the sprite, and then hiding the sprite and showing the clone. But, it appears as if the code for placing new sprites squares the number of clones placed and brings all of them to the character. I am new to this community and just began learning scratch. If there is a way to show the scratch code I would be happy to. Thanks.
What I think you'll find is that the code is calling for 'the sprite' as in the original and all clones of itself to move to the center, as the code runs for each instance (clone) of the sprite, hence causing it to replicate itself for every existing instance of the sprite.
What you would probably have to do is have an external script within the scene, or another sprite that has no clones, call the sprite in order to clone it, as I am fairly sure that scene behaviours can facilitate cloning of other sprites. From there, I would have it set some sort of global variable to the co-ordinates you want it to spawn at, and add a script for the sprite that makes it move to the co-ordinates specified by those variables when it is created.
Since you linked your project, I'll see if I can create a remix for it that fixes your problem tomorrow if the problem is still there.
Scratch has a clone limit of around ~ 301.
When you want to delete a clone, I suggest using the 'delete clone' block. If you think the screen needs to display more than 300 clones, you may have to use a method called stamping, where you store every x position on one list, every y position on another list, then render every position using a custom block. how to make it | example of the code
If you could screenshot your code, I could help debug it. I won steal it, so don't worry. And in case you're wondering, I've been been on Scratch for two years.
Related
I'm making a game in Scratch where if they touch something their HP goes down. I'm planning on making multiple of the sprite appear without having to use clones or make several of the same sprite so I'm using the pen extension to draw it. I'm running into a problem though. When I tell it to change the variable by touching the sprite, the pen copy doesn't count as it so it won't change it. How do you make the variable change when touching the pen?
The main reason I don't plan on using clones is due to Scratch's 300 clone limit. I intend on having more than 300 of the thing i'm making, which would go over Scratch's clone limit and why most people use the pen to get around that. The answer marked as accepted technically solves the problem until that point so I marked it as correct.
For the sake of providing a formal answer to this question, I'll just rehash the comments above.
A solution that worked ended up being to create an invisible (via the ghost effect) clone that goes over each pen drawing - each clone acting like a hitbox.
I created a bunch of non-AI animations for enemies that do basic back.forth or up/down motions. Everything was working perfect until I started working on the Boss of the level. The boss has his own tag "Boss" and enemies have their own tag as well. Anyway, the problem is when I click start, every enemy leaves the game board. I can see them animated above the game board still doing their routines.
Any clue as to why this happened and how to fix it? I'd really, really hate to have to scrap all the enemies and start from scratch...
I used the Animation tool inside unity.
Extra Note: I created an EMPTY and moved all of my enemies into that Empty object to clean the hierarchy panel up. The animations were fine before this.
************** Currently Resolved **************
Whew! Okay, so apparently Unity doesn't like it when you move your animated stuff into an empty AFTER being animated. I FIXED them by simply removing them from the EMPTY that I had placed them in. However, I'd still like to know why this is. So any useful resources, links, manuals, personal insight/observations or anywhere I can read up on this would be appreciated!
Here is an explanation what happened:
The moment you dragged them all into the empty GameObject I guess this object probably wasn't placed on 0,0,0 in the Scene.
So Unity automatically changed all the local position values of your enemy items to fit the current position offset to the empty object.
Result: In the editmode they don't change their actual global position in the scene but their local position. This is supposed to happen if you just want to organize stuff.
However, now when you start the game and the animations are played, the animators change all the local positions to whatever is stored in your animations.
Result: all objects jump back to their original localPosition which had an offset to the empty GameObject.
To solve this make sure the empty GameObject is at position 0,0,0 and optimally has rotation 0,0,0 and scale 1,1,1 before you drag anything into it.
Easiest way to achieve that is by clicking reset in the empty objects Transform component before starting to drag stuff into it.
I've spent about 20 minutes searching for this to no avail. All I want to do is create a double sided face for a shop sign for example.
I create a face that sticks out from the building, and I obviously want it double-sided, so I want to simply clone the face and flip the normal.
I know I can do this holding shift and translating the face, but then I have to move it back. I know that you can do this for an object in the edit menu, just selecting clone object, but it doesn't seem to work for sub-objects (ie., faces).
Also, when I searched for how to make a face double-sided, most suggestions were to change the renderer settings to change the face culling, or to apply a double-sided material. But, neither of these methods actually create a new face, do they? For example if I were to export it to my OpenGL project, exporting it wouldn't create the extra face vertices, would it?
Thank you.
Edit: I've been thinking, I know there are many ways to achieve this, I just thought I could detach the face to its own object, clone it in its place, flip the normal, and then attach the two objects to the original again, but the workflow is supposed to be easy.
Thanks.
OK, I've been playing around a bit, and found out that you can
1: Select the face.
2: Click Detach.
3: Select Detach As Clone.
4: Select Detach As Element if you want it to stay in the same object.
I've been developing a board-style game in Unity3D. The main scene is the board, and has the data about each player and the current (randomly-generated) board stored within it.
I intend to add minigames into the game, for example when landing on a particular space on the board. Naturally, I would like to code the minigame in a separate scene. Is there a way I can do this without losing the instance of the current scene, so that the current scene's state is maintained?
Thanks in advance :)
Short answer: no, but there may be another way to do what you want.
A basic call to Application.LoadLevel call will destroy the current scene before loading the next one. This isn't what you want.
If your minigame is relatively simple, you could use Instantiate to bring in a prefab and spawn it far away from the rest of your scene. You can even use scripts to switch to another camera, toggle player controls and other interactions in the scene, and so on. Once the minigame is done, you can destroy or disable whatever you brought in, and re-enable whatever needs to be turned on in the main scene.
You could create a separate scene and call Application.LoadLevelAdditive to load that scene without destroying the current one. As above, you can then use scripts to manage which cameras and scene behaviors are active.
If you're careful, you don't really need two separate scenes. It may be enough to "fake" a scene switch.
Hard to give a complete answer without code, but you should look into the following things either with the unity documentation or youtube:
PlayerPrefs, this is one way of saving data, although i believe it isn't entirely secure i.e. being able to edit from a text file.
Serializable, this is apparently better than playerprefs.
DonDestroyOnLoad, can carry over information to multiple scenes.
Static variables, again not sure if this will help your particular problem.
first time posting on stack and everything looks promising so far! I had a bit of a complicated question here so I'll do my best to provide exact details of what I'd like to get accomplished. I'm working with a third person controller in unity, so far everything is going great. I've dabbled with basic up and down platforms, a little glitchy but things work. Anytime my player runs through a mesh I make sure the mesh collider is working and a 'rigid-body' is attached set to Kinematic. Here's the kicker, in my game I have turning gears which the player can jump on. This is great except for the player doesn't turn with my gear, which would make sense according to my game-play. What would be the process for getting my character to interact with this animated mesh? I imagine some sort of script which my nooby mind cannot fathom at this point in my unity career. If anyone out there knows the solution to this, I would love to have any assistance, either way I'll plugging away at a solution. Thanks again!!
This is assuming that you're using the packages that ship with Unity3D, which it sounds like you are. After importing the Character Controllers package, you'll have a bunch of scripts in the Standard Assets\Character Controllers\Sources\Scripts folder, in the project hierarchy view. There's a script in there called CharacterMotor.js, attach that to the same GameObject you're running ThirdPersonController on.
Essentially this script adds more interactivity between the character and the scene. There's several methods inside this script that automatically move the character when in contact with a moving object (as long as it has a collision mesh) basically by inheriting the object's velocity.
If your gear/cog wheel has a proper collision mesh set up, adding this script to your character should be all that you require.