• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Space Invaders

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok so during the break I had to code some stuff for my project and I need help. This is the main class
This is the enemy class
and this is the entity class

So anyways I am stumped it is probably something easy but I can't see it.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow space invaders fun fun!

So what you stumped on?
 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It has to do with the constructor within the Enemy class my array Enemies are the only things not working so ya.
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see, your Enemy class constructor has 3 parameters. But when you use it in JForumAnimationJunk class (line 62), you pass in only 1 parm (the image), when it expects a int, int, String.

 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok now I have the problem of getting the enemies to move with this code I can't fix the errors regarding the move Saucer and move Enemies method.
 
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmm, the saucer works on my machine


maybe you should get some IDE and structure your code???
HTH
Matt
 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you misunderstand but thanks for the code I tried it out i would like the saucer to move without human input so move automatically.

Thanks again
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do you actually move the saucer?
I can't see that (offhand) in the actionPerformed.
 
Matt Cartwright
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Dave
that is correct,


is called by the timer and in the Sprite's move() method we do the boundary checking after adding the deltas from key events..

@Alaric
there were key events (q &e) defined for the saucer, that's what I implemented....
just take it as an example and use it for your laser cannon.
The saucer isn't visible in the beginning of the game and scrolls from left (off) to right off.
So the minX for it would need to be adjusted for that.
Why not have a counter incremented in in actionPerformed() that triggers the appearance of the saucer?
I think you got the idea...

HTH
Matt
 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok so I have moving enemies now I have the question of shooting using keybinding.
help?
shot

 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok so then I need help with collision detection for my barriers and enemies along with the player can you help?
this is the barrier
enemy
 
reply
    Bookmark Topic Watch Topic
  • New Topic