I think the hardest part here is getting the x and y values to move the object based on the angle. I guess we can add a shorthand way of doing that at some point.
RobinsonX
Posts
-
Projectile not showing up on layer -
Projectile not showing up on layer
The shooting logic is located in the Joystick object. I'll briefly explain how it works.- Joystick Input triggers while using the joystick.
- Debounce adds a cooldown so it doesn't shoot every frame. It limits how often its child behaviors are executed. In this case, it is set to
0.3sso you can only shoot one bullet every 0.3 seconds. - It spawns an object (the projectile), then it sets the spawned object's rotation to the
anglefrom the Joystick Input. - We perform sine and cosine Math Functions on the
angleto get the horizontal and vertical components respectively. These output a value between-1and1. - These components are multiplied because -1 and 1 is too small of a range. You'd probably want your projectiles to travel further than that.
- Move By moves the spawned object by the multiplied values.
In conclusion, while holding the joystick, the player will shoot a bullet every 0.3 seconds angled at where the joystick is. Depending on the angle, the projectile moves in a particular direction.
In the spawned object, you can add whatever logic you want. In this case, I made the projectiles emit particles and destroy themselves when colliding with an object with the "Wall" tag.
-
Projectile not showing up on layerHere is the project!
https://bit.ly/4x0FdQP -
Projectile not showing up on layerThe update has not released yet, so you won't see this z order setting yet.
I'll quickly whip up a demo project where you can shoot objects (instead of bullets) at whatever angle you please. You can customize the behavior of the objects if you like.
-
Recruiting for best game that you have ever made!Doing good! Nice to see you using this as a way to collaborate with others. Can't wait to see what you guys make! :)
We have a Discord server where you can chat with others if you're looking for quicker response times: https://discord.gg/RpXHJXq
-
How to save an added tag- You need to save and load the array.
- When loading the array, you must reapply the tags.
Let's start with saving and loading.
After modifying the array (it should now contain all the tags you need), you can trigger the Modify Save File behavior and save the entire array. When the scene starts, you can trigger Load from Save File with the same key you used in the modify save file behavior.Now you can load the array, but you must add the tags back, otherwise all the work you did for saving and loading was for nothing. Grab the loaded value from the load from save file behavior, and plug it into the Modify Tag behavior. There is an option to set the tags of the object (or append tags) which takes in an array.
-
Scene changA better approach would be to utilize the screen behaviors to move between images. This allows things to persist instead of the entire scene resetting every time.
-
Projectile not showing up on layer- App hasn't been updated yet.
- The Z order property is editable in the shoot behavior itself.
- I'm guessing you mean to have bullets ignore collisions of some objects - not possible at the moment. Treating bullets like objects would bring a lot of performance overhead. It would be a lot better to use actual objects instead since you can define custom behavior logic for each bullet.
-
Projectile not showing up on layerAlso, good news! This bug has been fixed. An object shooting a bullet will still be able to shoot bullets when switching layers. We've also added the ability to adjust the Z order of the bullets.
-
Projectile not showing up on layerI'm assuming the screenshot you provided is from a tutorial.
What this is doing is getting the rotation of an object, calculating the x and y values to use based on the rotation, and then applying a force using those values. Effectively, this applies a force on a spawned object (presumably a bullet, a physics object) in the direction of the object.
Normalized x direction is a Math Function behavior that is using
Cosine.
Normalized y direction is a Math Function behavior that is usingSine.However, I see that the names are mixed up in the screenshot. So
Sineis used for the x andCosineis used for the y.The multiplier is self-explanatory - you can adjust the power that is applied on the force. Larger multiplier means stronger force. It looks like it's using a health bar to adjust the power.
-
Bird eye diagonal viewpoints for character help!After some testing, I noticed I made some mistakes. You want to divide
angleby 360 divided by how ever many angles you have. In my example, I used 8 since I have 8 angles. Then you round it - you'll get a range from -4 to 4. Range changes depending on how many angles you have. 0 is up, 1 is top right, etc. Note that when it reaches -4, it goes to 4 but it's still pointing in the same direction. It's just that the angle becomes negative when the joystick ball is pointing to the left. Here are screenshots that should help.



-
Bird eye diagonal viewpoints for character help!If you have more directions than the 4 cardinal directions, then I'd suggest using Joystick Analog. The Joystick Controlled behavior only works with the 4 cardinal directions. Joystick Analog outputs
angle, and based on that angle, you can play a different walking animation.For example, let's say you have 8 different angles (4 cardinal, and 4 diagonal) - you would divide the
angleby 8 and round it. You get a number ranging from 0 to 7, each number corresponding to a direction. 0 is up, 1 is up and right, 2 is right, and so on... You can use If to check which angle it is and play a different walking animation. -
How to Stay inside a background object with different devicesNo I never had the need to do anything like this, but if I'm understanding this correctly, you want the image to clamp to the screen's boundaries when the image is larger than the screen.
There's no built-in way to do this.
The easiest thing I can think of is moving the image to the player every frame (Frame Event --> Move to Object) and then using the Clamp Value behavior. You can clamp the x and y position of the image as it moves and restrict it to a rectangular area. You would have to account for the dimensions of the image and the screen. -
How to Stay inside a background object with different devices
Why not use the built-in background option in scene settings? It has the option to doAspect Fillso the background will always fill the entire screen without stretching -
Move player forward In their directionYou can use a Move to Object behavior and move the object to itself. But change the anchor point of the second object to be slightly above the origin. Now the object will move "forward" regardless of the rotation. So at 0 degrees, it will move up, and when rotated 90 degrees clockwise, it will move right.
-
Dictionary load and save tutorialsI'm confused on what you're asking for. Can you share your project and explain what your expectations are?
-
Best way to erase something in an arrayThat's probably the best way to do it at this moment. There's no built-in way to do that. We can add in another option in the Modify Array behavior to delete a specific element in the array.
-
Dictionary load and save tutorialsHow to manage the attribute keys with multiple objects.
Unlike in your example I have many object spawn at the same time. What do I put instead of “source object id”? Does it have to be dynamic?It looks like you're spawning multiple objects per iteration - maybe you meant to spawn one object per iteration?
To answer your question, "source object id" is just an arbitrary key I used. You can name your key anything that makes sense to you. It can either be dynamic or predefined - there's no difference functionality-wise.
-
Dictionary load and save tutorialsIt’s weird because sometimes it delete the source even if the ID is not the same… For that I do a modify array by doing a get array value at index when the spawn object is touched. But it doesn’t work every time. I don’t understand why.
It is worth noting that Get Array Value takes a number for the index. If you put text for the input, it treats it as 0 (getting the first element instead).
-
Dictionary load and save tutorialsYes but it is coming from a loop and a spawn the entire array. So what would you do?
I'm not sure what you mean by this. Can you send a screenshot/picture?