Jump to content




[Solved weirdly... Check it out.] Weird problem with game


  • You cannot reply to this topic
10 replies to this topic

#1 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 19 February 2013 - 06:53 AM

Hi! I am making a game with ships shooting lasers and I ran into a problem. The xLimit and yLimit values are what I think are causing the problem, but I can't figure out how. The ships, when they start, only go down, until they reach like halfway down, and then can go up and down but only up halfway. They can also go lower then the screen, and that is a problem. Just test it to see what I mean, k? :P

NPaintPro sprites: http://pastebin.com/YMfvLfwz They need to be named what is in the brackets next to Ship, Ship2, and Laser.

Game: http://pastebin.com/brbUAS1E

GameUtils: http://www.computerc...sion-detection/

Thanks in advance for your help!

--Mudkip (Yes, I commented my name :P)

#2 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 19 February 2013 - 07:13 AM

Oh ya, I forgot to say i didn't implement shooting yet, so thats not the issue.

Edit: Now that's 2 ask a pro questions that everyone has abandoned...

#3 ikke009

  • Members
  • 224 posts
  • LocationSliding between sunbeams

Posted 19 February 2013 - 08:44 AM

2 things.
1. instead of comparing key to keys.up and keys.w seperately, you can do that in one sentence (if key == keys.up or key == keys.w then)
2. to solve the problem you could do something like this
 local w,h = term.getSize()
--then add the following after the ship has moved
if ship.y > h then ship.y = h end 
that should move the ship back to the bottom of the screen if it tries to go out of it.

#4 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 19 February 2013 - 11:23 AM

That does not answer my question. Have you RAN the game? It SHOULD just go up and down through the screen, but it seems like it is offset.

#5 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 19 February 2013 - 02:50 PM

Can anybody help me? I am trying to make this a long-term project, but this is a fatal error.

Edit: I know I know, Y_U_SO_IMPATIENT, but I really want this fixeeedddddd..... XP

#6 ikke009

  • Members
  • 224 posts
  • LocationSliding between sunbeams

Posted 19 February 2013 - 10:25 PM

No I was unable to run your program when I earlier responded. I thought you said the problem was that the ship could go lower than the screen.
If nobody has helped you in a couple of hours, I'll take the time to run the game and see what the problem is exactly.

#7 ikke009

  • Members
  • 224 posts
  • LocationSliding between sunbeams

Posted 20 February 2013 - 12:50 AM

Im not sure what the problem is.. Both ships are moving up and down perfectly fine for me

#8 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 20 February 2013 - 03:00 AM

Can you move up to the top of the screen?

#9 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 20 February 2013 - 03:05 AM

View Postikke009, on 19 February 2013 - 10:25 PM, said:

No I was unable to run your program when I earlier responded. I thought you said the problem was that the ship could go lower than the screen.
If nobody has helped you in a couple of hours, I'll take the time to run the game and see what the problem is exactly.

Yah, that is the problem. I want it not to be able to go if it goes below the screen.

Edit: It seems to go 31 blocks below the screen.... o_O

Edit edit: IT WORKS! Just set yLimit=ySize-36 to work! :D

#10 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 20 February 2013 - 03:29 AM

here is your problem:

local ySize, xSize= term.getSize()


term.getSize() returns width,height. not height,width

#11 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 20 February 2013 - 01:45 PM

View Postdan200, on 20 February 2013 - 03:29 AM, said:

here is your problem:

local ySize, xSize= term.getSize()


term.getSize() returns width,height. not height,width

Wow. Oh. I feel stupid now. XD But thanks!





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users