Shows the Creaticode screen when I place DJ in -- "goofy Tower Defense test room"
-
When I place the DJ, there is a hat sprite that is supposed to appear on the DJ, but instead this screen shows
Please help with this bug and what went wrong,
Thank you. -
What’s the project URL?
-
-
@info-creaticode Nevermind I fixed it
-
@info-creaticode Can you help me with making the units face the first enemy they see? They target the fastest right now because all I know how to do is target a specific unit, and if they kill that one they target a certain other, and so on and so forth
-
Can you define what’s the “first” target? Do you want it to lock at the most front-running target? Or the one with the earliest born time?
In general, you should not use the “point towards [sprite]” block in this case. Instead, you can try to compare all the targets based on your rule, and find out which target is the one you want to point at, then you can save its x/y positions into 2 variables.
Then, in the gun sprite, use the point towards x y in N seconds block.
-
@info-creaticode I mean the one that is ahead of the other enemies, and if there if one that gets ahead of the one that used to be in front, that enemy will become the “first” enemy
-
In that case, you will need to write some code to check which target sprite is currently the first. One way to do it is to look at how far it has traveled. Since every target starts at the same point, the one that has traveled the most should be the leading one, right?
And assuming each target has a constant speed, you just need to multiply its speed with how long it has been moving to get its total travel distance. The one target with the longest travel distance must be the leading one.
-
@info-creaticode So what I’m getting in simple words is, {enemySpeed}*{timeOnField}={totalDistance}, find the enemy with the highest total distance, and point towards that enemy?
If so, would you then put to variables labeled {firstX} and {firstY}, and use those as the direction the units need to aim?
-
-
@info-creaticode Will each sprite require their own variables or can you edit them to where {enemySpeed} and {TimeOnField} can affect individual enemies?
-
There are many ways to do this. For example, you can use a table or list to store all the speed and start time of all sprites.
This might be a good time to ask XO for specific coding suggestions.
-
@info-creaticode I’ve tried, but it doesn’t appear when I ask it something. I’ve tried debugging and restarting the chat but it doesn’t work
-
That’s strange. Are you trying at school? It might be blocked. Can you share a screenshot?