Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Cursor problem

In my script i want to have it if @cursor is over a command the @cursor.y changes this is what i have below but it isnt working

if @cursor over @command_window.item(1)
  end

Thanks in advanced:D
-Sobeman459
 
You need to add a couple of things...

1st: RMwhichone?
2nd: Which script are you using either way?

But before that, you might wanna try replacing the 'over' command that's most likely not defined :p Depending on your script, you might have a method for something like this ready.
 
I just realize that you might be talking about a non-mouse cursor... in that case, you could use something like this:

Code:
for i in 0..@command_window.index              # for each index defined (aka three if you use the default window: 0, 1, 2), using the placeholder variable 'i'
  @cursor.y = @command_window.y + 16 + i * 32  # sets the cursor y position to command_window's position, adds 16 because of the window border (might need to adjust that because I simply can't remember the value, then adds i times 32 to it, aka 0 for the first item, 32 for the second, 64 for the third)
end

This code belongs into update definition, preferably on the top. It's written variable, so if you modify your command_window items, this will automatically adjust.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top