• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

game movemtn

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i had a question but i am not sure what the problem is.
if user keep right key down. than camera should move left.and my player should fall down bc there are two empty(sky,'0') under player.

move camera.


now to move level iam doing doing this in paint method in level class.

above code will move the bottom floor when user moves left and right.


than i am setting a collision box around every where i see '1'(ground)



not to check for collision i am doing:


if i print the this.rect.get(i) in if statment: i get
java.awt.Rectangle[x=0,y=20,width=5,height=5]

now if i move to right block: output is
java.awt.Rectangle[x=0,y=20,width=5,height=5]

should that be?
java.awt.Rectangle[x=5,y=20,width=5,height=5]


also my player jump method:

 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic