This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Discussions
You need to login to take part
Current Discussions
Targeting Multiple different classes
By B_rob1, with 6 replies.
Last reply by danpost, about 8 years ago:
I was taking a closer look at your code. You said:
B_rob1 wrote...
So with my current targeting system, It finds nearest unit.class and spawns the bullets in the direction of the units using lists
where, in fact, it does not find the nearest one. It only has the actor turn toward the first one listed -- which is not necessarily the closest one. You need to go through the list and compare the distances from the actor to determine which is the closest. For that, you need two variables -- one for the closest actor found so far while going through the list and one for its distance from
Spawning bullets
By B_rob1, with 2 replies.
Last reply by B_rob1, about 8 years ago:
Thanks,
Scenario stops after pressing "A".... help
By Denni, with 7 replies.
Last reply by danpost, about 8 years ago:
Denni wrote...
so... what should I do, I'm pretty frustrated and don't want to do anything wrong
For now, you can just remove lines 47 through 51 from the
Collision
method as shown above. You can then ask yourself what behavior you want the
Spieler
object to exhibit when
velocity_x
is negative and no
Box
object is encountered (maybe nothing).
Having issues with this code...can anyone help?
By Shookems, with 2 replies.
Last reply by Shookems, about 8 years ago:
thanks
problem with my code
By tosteck, with 8 replies.
Last reply by danpost, about 8 years ago:
tosteck wrote...
image file names are Wall.png for normal wall << Image Omitted >> Wallside.png for sideways wall << Image Omitted >>
Add the following line inside the last
if
block (before line 21 as shown above): <Code Omitted>This is the same as: <Code Omitted>
My program won't run on the website.
By ItsChestDay, with 1 reply.
Replied to by danpost, about 8 years ago:
ItsChestDay wrote...
My program won't run on the Greenfoot website. It works fine, but just wouldn't run when I shared it. Please help. Thank you.
Copy (or move) your three sound files,
Hitman.mp3
,
roblox.mp3
and
Fortnite Floss for 6 minutes.mp3
from your
Downloads
folder to the
sounds
folder in your
test
scenario folder. Then drop the paths of all references to those files (just use the filenames with their suffixes). It should run on this site after uploading with those changes made. I do not know if the spaces in the last filename are allowe
Pacman Ghost AI
By Ticker175, with 2 replies.
Last reply by Ticker175, about 8 years ago:
thanks for the response =). i did find out after reading up about the ghosts personality's that i was incorrect but tbh i like my version better xD Yes i was pretty sure that the tiles wernt 30x30 but i personally like working with either 30x30 or 60x60 just because i find it works better with finding sprites ill check out the links now Thanks Thomas
Making a clickable menu
By Xolkiyr, with 1 reply.
Replied to by danpost, about 8 years ago:
Create, keep a reference to (add a field to hold the button object) and check for mouse clicks on the button in the class of the menu. Also, add a field in the class of the button to track which button is currently being hovered on. Basically, something like this:
How to get x,y cords
By Ticker175, with 1 reply.
Replied to by danpost, about 8 years ago:
Ticker175 wrote...
how to get the coordinates of an actor (player) to use in another class
You first need a reference to that player actor. Basically, something like the following: <Code Omitted>The best place to get the reference in the class depends on how the coordinates are used and how often you need to get them.
how do i use global variables
By sufyaan, with 2 replies.
Last reply by sufyaan, about 8 years ago:
thanks
Aiming at objects
By grnft, with 2 replies.
Last reply by danpost, about 8 years ago:
grnft wrote...
The error message just tells me that there's something wrong with the turnTowards method.
Yeah. What does
harry
refer to? That is, where is the variable (or field) being declared and what is being set to it?
My extra life doesn't work
By grnft, with 9 replies.
Last reply by grnft, about 8 years ago:
Now, my code looks like this:
How to stop a single method from another class
By grnft, with 8 replies.
Last reply by grnft, about 8 years ago:
as long as the protected method works: isProtected = true() killDementor() NOT killHarry() of the Dementor class It has only one life, but this one is protected as long as the timer works. Maybe it would be easier to just give him four lifes as soon as he hit the "Tarnumhang class" but this case doesn't work on another object either. Then I would create a healthbar. See another discussion on greenfoot "my extra life doesn't work".
If-statement: actor has a specific picture?
By elena, with 3 replies.
Last reply by danpost, about 8 years ago:
elena wrote...
How exactly do I "ask" whether the Image is the Image B? << Code Omitted >> So far, I have the code above but <Code Omitted>doesn't work and I don't know what else to use in that line...
GreenfootImage
is class name -- not an image name. Objects created from the class are
GreenfootImage
objects that you can name yourself:
Wall that doesnt let Tank pass
By Mirco420, with 9 replies.
Last reply by danpost, about 8 years ago:
Mirco420 wrote...
Habe noch eine Frage ...
English please -- and if this is a different issue, please start a new discussion thread and show related codes.
247
248
249
250
251
252
253
X