Comments (1)
This is not a bug. You have 2 weird things in your code.
This is the code that is responsible for selecting the units in the background of the live editor :
func select_units(cells: Array) -> void:
selected_units.clear()
for cell in cells:
if cell in units:
selected_units.append(cell)
update()
You did not need to know this to actually complete the exercise but its better to show you.
What your code does is to call the func 4 times with 4 different arrays instead of doing it only once. Your code would have worked if the code above would not have had selected_units.clear()
but this is beyond the purpose of this explanation.
select_units([1,0])
select_units([5,1])
select_units([4,2])
select_units([0,3])
Instead of this try calling it in a proper manner something like : select_units([Vector2(x, y), Vector2(x, y), Vector2(x, y), Vector2(x, y)])
.
Second thing you understood wrong is that you're trying to call select units with an array containing simple numbers as each index instead of a Vector2 which holds coordinates. Please revisit some of the chapters prior to Lesson 18 for a better understanding.
from learn-gdscript.
Related Issues (20)
- Lesson 7 Exercise 2 is completely broken. HOT 3
- the code is giving an error though it is exactly the same as the solution HOT 1
- Some features are not working as intended
- Lesson 7 Practice 2
- 20. Strings Lesson 2 Issue with different variable names.
- gdscript
- [Very Minor Correction] Period goes on next line on Lesson 4 - Drawing a Rectangle
- Broken links on completion page HOT 2
- Lesson 20 - Excercise 2, right answer with wrong script
- "Lesson 23 - Excercise 2: Realign the train tracks" problem to understand task
- [Lesson 14. Multiplying Part 1 Practice] Incorrect math calculation regarding max_health value, appears to level up twice when my code only asks it to level up once
- script with str function call fails
- Lesson 18 creating arrays should say 'unroll' not 'unwrap'
- Lesson 25, inconsistency between add_unit example call arguments and practice exercise place_unit function
- lesson 23 practice " Using right items" task is a unclear and may be teaching bad habits or hardcoding values HOT 2
- Lesson 27, practice 2 doesn't actually differentiate between ints and floats HOT 1
- Lesson 17 - "Moving to The end of the board" suggestion
- Lesson 7 Practice 2
- Creating a parameter list with undefined parameters messes with my brain
- Lesson 17 misspelled word
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learn-gdscript.