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
Individual Shots
By t3mp3st_0, with 3 replies.
Last reply by danpost, over 6 years ago:
Erasedsword wrote...
<Code Omitted>
Line 4 is not where the spacebar is only down. Its state is not determined until after line 5. An
else
clause following the
if
block (lines 5 thru 8) would be used for key down state. Line 4 is only for a unknown change in the state of the spacebar.
Power Up issues
By Erasedsword, with 6 replies.
Last reply by danpost, over 6 years ago:
In the DUP class code, add the following line after line 18: <Code Omitted>Then, in the act method, add the following line after line 34: <Code Omitted>These lines will immediately cause an exit from the methods so that no further code that require the actor be in the world be executed.
Code for Spawner
By Brandon13, with 1 reply.
Replied to by danpost, over 6 years ago:
Brandon13 wrote...
I am trying to make my spawner spawn a certain number instead of unlimited spawing but unsure of the code
Add a counter field to count number spawned: <Code Omitted>Add the following line immediately after spawning: <Code Omitted>Adjust the limit (10) as needed.
Error:java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
By rma943, with 8 replies.
Last reply by danpost, over 6 years ago:
Dr.Blythe wrote...
Of course, since we didn't cover how to use the results of getObjects (or even mention the get() method), there must be another (much simpler) way to do this!
You could keep a reference to the Runner object in your World subclass along with a "getter" method: <Code Omitted>Then, use the following in your Actor subclass:
sending variables between 2 files
By yaronbr, with no replies.
hello. im new to greenfoot, and im trying to create a board game where the board of the game is revealed to all players but each players hand can only be seen by that player. i created two different greenfoot projects and am trying to send a variable between them so one project can influence the other. tried doing this with an abstract java class but it doesnt seem to work a) is there a way to get two projects to communicate with each other? b) is there a better way of creating a game like this? thanks
Stoping sound when a world changes
By Erasedsword, with 3 replies.
Last reply by Erasedsword, over 6 years ago:
I just figured out that I had the methods called in the wrong order. It’s working fine niw
Greenfoot debugger when adding sound
By Erasedsword, with 11 replies.
Last reply by Erasedsword, over 6 years ago:
Yes that was it thank you
How to make an actor appear after something happens?
By Poseidon420, with 4 replies.
Last reply by Poseidon420, over 6 years ago:
Thank you dan it worked now
Multiple worlds
By Andrew0739, with 1 reply.
Replied to by danpost, over 6 years ago:
Andrew0739 wrote...
How could i save all the states of my main world, create a different one, lets call a battleWorld, do some stuff in it, and then go back to the main world without resetting everything (saving the progress). For example i have the main world where the player walks around, if the player comes in contact with some particular object then it will initiate battle and once the battle ends the world will continue running where it left off. Not too sure how to implement this. I was told that a possibility could be to create the new "battleWorld" and have it point to the original world
Animation help?
By MadameMinuit, with 3 replies.
Last reply by MadameMinuit, over 6 years ago:
Thank you so much! I don't think I did quite what you intended, but this new code does what it's supposed to do.
How do you restart the level when the player touches the ground?
By MickeyMouse123, with 5 replies.
Last reply by danpost, over 6 years ago:
MickeyMouse123 wrote...
Yep, I did that. But I keep falling through platforms from a great height. I know that the direction of movement will determine whether the player should be placed above or below the object it collided with but I don't know how I can alter my original code.
Line 76 ;should probably use the
getOneIntersectingObject
method instead of the
getOneObjectAtOffset
one. You can add another condition to line 77 such that the vertical speed must be positive.
Error: BossFight cannot be cast to game
By Razaph, with 2 replies.
Last reply by Razaph, over 6 years ago:
Already fixed it ^^ When I joined the BossFight World I tried to Access to the game world and that was the reason
How do I "hit" another Object of Actor?
By Yorik, with no replies.
So, I am trying to program a brawl game like Smash Bros., but simpler. The problem is, I don't know how I can make two actors hit each other... Can someone help me, please? Thanks in advance, Yorik P.S.: sorry if my English is not very good
Character Falling Through Floor
By Underdemon, with 19 replies.
Last reply by danpost, over 6 years ago:
Wow -- I had no idea you were talking about a thin line of green. As such, you might be better off adding
Ground
objects into the world -- just invisible rectangles whose top edges line up with the horizontal green lines. The Ground actors can then be used to prevent the "falling through" issue. Let us fix the "subclass doesn't change" issue later and worry about the "falling through" right now.
Code
By Multisciente, with 8 replies.
Last reply by Multisciente, over 6 years ago:
Ok. =)
203
204
205
206
207
208
209
X