ID:1189082
 
Keywords: bricks, byond, help, on, screen, viewing
(See the best response by Emasym.)
Problem description:

I've just started to read and learn the BYOND language and I am currently working on a mini project to help me better understand BYOND coding.

anyways, I have been trying to find a way to make the user mob to not be in the center of the screen but elsewhere (on the bottom of the screen for example), how can I do this?

And how do I make it so that the screen doesn't move while the user mob moves around?

Also:
Code:
atom
proc/Bumped(mob/M)
dir = turn(ball.dir,180)
return


why is this an error?


PS: I'm trying to make a simple game of bricks
PSS: sorry for being a super noob
Best response
The center of a client is based on the client eye var. You can put it wherever and then the mob will be 'unlinked' from the player's view.

As fgor your snippet, several things;
Most likely it's giving an indendation error. This is because you put your 'return' statement an indent higher than your other line (dir = ..), while they're both on the same level (working inside of Bump())

Now, your Bumped proc right now is not doing what it should do.
You've specified the atom it bumps into as mob/M, but there is no guarantee it actually will be a /mob , you're just referring to it as such. If you try to, say, output the mob's client, and you bump into a tree or whatever has density, you'll get a runtime error.
Also, let me presume the 'ball' is the thing that should be turning, while your Bumped() is defined for every atom.

Keeping in mind both remarks, this would be the way I'd handle it
atom
Bump(atom/a)
..()
a.Bumped(src)
proc/Bumped(atom/a)

obj/Ball
icon='ball.dmi'
Bumped(atom/a)
if(ismob(a))
//If a is of type /mob
var/mob/M = a // This is called 'typecasting'
//from here on out we can use M to safely output the mob values of a
//which is safe since we have established a is a mob
world<<"Ball bumped into [M.name], who is a mob!"
dir=turn(dir,180)

okay thank you for the help. I'll try this out and see how it is when I get home.

What is the "..()" usually used for? and in my understanding, M is already a pre defined variable for mob right?
..() pretty much means, "do the usual action". In BYOND, you can overwrite almost any built-in procedure, such as Bump(), Login(), ... but to still have that proc do their normal work, you call ..() . It is called the 'parent' proc, because it runs the proc you're in how the parent would.

mob
proc/sayThing()
world<<"mob"
player
sayThing()
..()
world<<"player"
verb/say() sayThing()


This will output:
mob
player

And no, M is not pre-defined. It's just what most people use.