How do I make players on Roblox spawn as different objects? - lua

For example: In my game I want player to spawn as a ball? How will I accomplish this? I can't find it anywhere on the web, though I have searched and searched. I haven't got any code because I haven't the simplest idea of how to do this. Thanks for your help!

First things first; You'd probably have better luck over at https://scriptinghelpers.org/questions it's like Stack Overflow but for only Roblox related questions.
now, if you want the player to spawn as anything other than the default player, you have to do one of two things, prevent the character from loading, or remove it when it does, once you've accomplished that, you should bind the camera to the desired object, and bind movement to keys.
an easier, but much less elegant solution would be to find and modify a standard character morph to simply make it appear that you're a ball.

Related

How would you go about creating a random spawner for coins within a certain area? It has to re-spawn coins after the player has collected enough too

I have a coin which rotates and changes size so far. I want to be able to set an area (which is not a nice square of course) that they can randomly spawn locations. The thing it has to do is once there are less that 7 coins then it spawns more.
Anyone able to give me some advice? Not sure what is most efficient method.
It sounds like you should be making use of ZonePlus and its getRandomPoint function.
If you want a direct reference, the creator of the module made a playground and its source code is publicly viewable. The playground contains a 'CoinSpawner' (literally what you're looking for).
You can either make use of "Region3" or you can set up multiple possible spawn points and run a math.random function to choose which one.

How to add "Action Points" to Scenekit Game using Gameplaykit or something similar

This is a very common question, and I am not asking for technical details. What I am looking for is an approach or best practice guidance for the following situation:
Imagine a jump and run game entirely made with SceneKit. The game is played by controlling a character running to the right or left side, climbing up walls and jump over obstacles. (it is a 2½-D style game where the character always runs in one direction or it's opposite. Mainly on the x-Axis)
At certain "locations" (on the scene x-axis) I need to implement some specific actions, that should occur as soon as the main character walks, jumps or runs over that specific point.
What I have done so far, is adding simple invisible SCNPlanes with static physics bodies, with the bitmask configured to detect only the contact (no collision). In the physics handler (physics delegate) I can now fetch contact of the objects the character trespasses. Currently I have a large switch-statement to fetch the names of the "Action-Walls" as I call the planes through which the character walks. So, I can trigger whatever specific action that I want to happen at that location.
It is working this way, even quite good, but I wonder if there is a way to add some better "action points" using i.e. Gameplaykit, but I only find information about agents and behaviors or pathfinding.
What I am looking for is some static point, when trespassing it, an associated action happens.
I have no clue about the possibilities of Gameplaykit. Can anyone tell me an approach using Gameplaykit or whatever Apple has in its magic box of useful tools to make this better than using action walls of SCNPlanes and the physics handler?

How can I remove sprites when they are outside viewport, but then add them again if I return to their location to save memory

I'm creating an open-world RPG like Neverwinter nights. But I'm worried about memory and am afraid if I just populate a huge world with physics-based sprite nodes, I won't have any memory for anything else.
To combat this, I want to remove the sprites when they go far outside of the viewport and then re-add those sprites when I get close to their location.
How could I accomplish this?
To any and all who take time to help me with this, thank you!
You can store all data on a database like CoreData with exact parameters you need like states and positions whatever do you need.
Then you can create a method to get all objects on a specific position with radius and use this method when the player moves or when you need to check things like a quest on another site, take those objects and compare with current objects, place again on the correct site the new ones and remove the old ones (they are not on radius probably or disappears for another reason)
This is a complex approach but it could work.

how to allow an object to move through gaps in an skphysicsnode

I want to try to have a sprite kit node move through this image and when it contacts one of the blocks it executes a function and is blocked from moving forward, but it can pass through the gaps. The way my code is set up now however, the entire image is recognized as one node so nothing can pass through even the gaps. I was wondering if anyone had some suggestions on how to work around this without having to add each individual block as its own node. Thanks.
Sorry to disappoint you but what you want to do is not possible. I know of 2 ways to detect collisions.
1) through physics like you are already doing
2) through use of intersects(_:)
Both of them require you to have separate objects. Else how is the system supposed to know the difference between the space in-between the objects and the objects them selves. Your saying you want one massive object. Maybe you could write some great script that detects intersection of different colours, but that would be a really strange solution to a simple problem
Like Steve asked. Why do you not want to add them individually? It's really easy to do. Just create an instance of the object then add it multiple times with different positions. If you are not sure how to do this then, this is the question you need to be asking.

Dragging with inertia in AS3 for dummies

I'm trying to create an inertia effect for dragging that's constricted to the x axis. I know this questions was asked before here but I couldn't understand the answer!
I'm currently using startDrag and stopDrag. I'm assuming I should add something to the startDrag function that captures the speed in which the user is moving the mouse, but I'm not sure how this is done. I guess then I'd add something to the stopDrag function that kicks in and makes the object keep moving at that speed and then come to a stop.
Any suggestions?
I've found an grat online tutorial that has the answer. I was a matter of tinkering with the code. The writer even has .fla files for download.
http://www.quasiuseful.com/?id=11

Resources