Anything I can add/fix? - Bot Test
-
@tyller_, There’s a slight issue with that.
I have problems with cloning because it never seems to work properly and there are always bugs. I end up just coding everything in the main sprite instead of a clone.
If you want, you could help me with this problem and show me how to re-code it.
-
@011830-0a42ef84 sure, share it (I think Im friended so if you really don’t want it public you can share with friends) my idea would either be a custom block that adds data to a list and/or sends a broadcast with parameters, then the ai receives that and process it, so for the broadcast it would be (assuming you want a custom block to format the data and be repeatable easy)
PS: as I’m typing this out I realize it’s hard to understand if you don’t have experience reading script code or using broadcast blocks to put data in a string and using part number of string to get that data
The custom block:
define makeSound(x, y, loudness) /
broadcast (sound) with parameter (x, y, loudness) // use something like join text with separatorIn the ai sprite:
When I receive (sound) with parameter [inputs] /
if (distance between sound x sound y and x position y position < loudness) then
---- // do the stuffIF that was confusing I Think if you tell xo chat what I described it as they can make an example or just make it (so if you tell xo chat something like “make a custom block that takes an x and y position as well as a loudness value and broadcast it, then a receiving broadcast block to handle the sound” infact you might be able to ask it to implement the sound system as a whole
-
@tyller_ I shared it.
I made the sound (when you shoot) by subtracting the X and Y distance between the bot and the player. If the X distance is less than 150 and Y distance less than 100 when you shoot the bot will hear it and target you.
-
@011830-0a42ef84 you shouldn’t do anything different based on x and y, since i ts top down x and y should be pretty much treated the same as mechanics
-
@011830-0a42ef84 something to add, please try resharing it or un sharing and putting sharing back on, it shows a remix button but I can’t see inside and I tried just adding /editor?version=1 to the end and it showed hte editor for a second before kicking me bakc out (the version=1 is just something it adds, it did have that on the end when I got sent back to the main page)
-
@tyller_ I just added share to all,
here’s the link:
https://play.creaticode.com/projects/67a22b077b46e6c9fc9dc409
A lot of things might be confusing with how I code it in, so added notes/comments to many of the code chunks
-
@011830-0a42ef84 I’m going to just go through and see how it works, I’ll probably try making it scalable (able to have multiple zombies/ai’s) and ig because you already have so many sprites I’ll try to make them all work in conjunction (it’s probably good practice to use multiple sprites, I just tend to for some reason unknown to me use very few sprites, though ig sometimes it’s okay but then sometimes I make an entire project in one sprite and don’t mean to) I increased the canvas size and locked the viewport to the player so stuff can be tested with that, now that I type this I kinda wanna try doing ray casting stuff but idk, sry Im rambling
TLDR: I might rework it or just make it compatible with clones
-
@tyller_, Lol
I added a lot more variables and sprites than what I originally anticipated because I wanted to have a better AI than one that just either goes toward you constantly or doesn’t feel as realistic as the one I created. -
@011830-0a42ef84 I understand what you mean, I think I’ve thought of a way where you can make all the detectors one sprite, then have it spawn clones for each detector and on a when touching it gets the clone id of the one touching the player and broadcasts stuff based off that
-
@tyller_, That sounds good.
Feel free to make one if you want so I can see what idea you have in mind because I doubt I can make that happen. I kind of just stop at cloning, IDs, lists and all that stuff.If you could, I would also like to know how to scroll (viewport) the map because the CreatiCode AI doesn’t help explain it.
-
@011830-0a42ef84 you have to click edit in the top left of the screen then change the canvas size, put it at like 1000 1000, then in the player sprite get the “lock viewport to sprite” block and set it to Player, then you have it
-
@tyller_ Do you have a remixed version? I just deleted a core sprite by accident and i don’t have any backups :c
-
@011830-0a42ef84 yeah, also if you have the tab still open click edit and try clicking restore sprite, if that isn’t there then try refreshing without saving
edit:https://play.creaticode.com/projects/67a4fb9137d5f05663875c86
edit 2: I touched some stuff so make sure everything is connected (I was going to disable some stuff to rework it)
-
This post is deleted! -
@tyller_ I got lucky. Thanks
-
@tyller_ When I added a viewport, the looking at mouse trigger bugged and it won’t properly.
-
@011830-0a42ef84 oh yeah , I added stuff to fix that, you have to do
point in direction(direction from x (0) y (0) x(mouse x) y(mouse y))
in order to do it, its a weird bug, I think what it’s doing is pointing from player x y to the mouse (which makes sense) but the mouse x y is relative to the screen, so you could be 500 pixels right and if you click in the middle of the screen, instead of showing 500 mouse x 0 mouse y it shows 0 mouse x 0 mouse y, and if you want something that isn’t the player to look at hte mouse I can make an example if you really need i t
-
@tyller_ Can you screenshot the blocks?
-
@tyller_ I’m using this as a pointer:
the problem is, it starts bugging when I go near or on the edge -
@011830-0a42ef84 it always bugs like that, I don’t know how to fix that since yo can’t use viewport x/y because that is not relative to the real x y position of the viewport (its some weird shortened one)
-
@info-creaticode, can you help with making the player point to the mouse pointer with a bigger viewport than the original?
-
@tyller_ Can you help implementing clones for the zombie?
-
@011830-0a42ef84 Sry, I had started doing some javascript stuff and using my laptop as a webpage host server for testing stuff, I currently can’t use vscode.dev because I had to give my charger to my brother so my laptop auto powered off, so for today I’m going to try to do some creaticode stuff
-
@tyller_ So you are or aren’t going to implement clones? I’ve already made a round system so it would be very cool if I could add clones
In Ver. 1.0 I’m planning on adding a multiplayer system and a shop.
-
@011830-0a42ef84 Here it is
https://play.creaticode.com/projects/67a4fb9137d5f05663875c86
I was gonna combine (which I really should of cus there’s so much repitition in the blocks) but I did this, it was the easiest method to think of and I didn’t ant to drag costumes, instead dragging blocks and copy pasting alot -
@tyller_ Ty this is really helpful for later versions, but there seems to be an issue in where the bot seems to not want to turn to face the player. Do you know the issue to this?
-
@011830-0a42ef84 yeah so the issue is likely that multiple broadcasts are being sent per frame, which causes only some broadcasts to work,there is no way around this as far as I know, actually a really scuffed/creative way could be you have each thing add to a list the instructions, and then each clone looks for their clone id in the list and follows that instruction (actually I might do that in my cell game to prevent a bug I’ve found with my black holes)