rudy van etten's blog is looking good?

Community Forums/Monkey Talk/rudy van etten's blog is looking good?

gerald(Posted 2015) [#1]
I clicked on the new help blog below. It looks like a real good beginner help blog. Code examples and running examples. I will give it a try!

Gerald


steve_ancell(Posted 2015) [#2]
You forgot to provide a link to the blog.


gerald(Posted 2015) [#3]
Hi,

It is the fourth one down in this discussion site. Pakz's new monkey-x example blog.

I tried 6 of them and they work in htmll5. The moving cube and oval and box and stuff work. They paste and build and run correctly. I did chop off the include mojo on one of them but recognized it was missing. That's the depth of my skill at this time.


Here is the code for the boing example in the pdf. It does paste and build but the result does not run? It doesn't load the png picture.

Import mojo
Function Main ()
New Game
End
Class Game Extends App
Field player:Image
Field x:Float
Field y:Float
Method OnCreate ()
player = LoadImage ("boing.png")
SetUpdateRate 60
End
Method OnUpdate ()
If KeyDown (KEY_LEFT) Then x = x - 4
If KeyDown (KEY_RIGHT) Then x = x + 4
If KeyDown (KEY_UP) Then y = y - 4
If KeyDown (KEY_DOWN) Then y = y + 4
End
Method OnRender ()
Cls 64, 96, 128
DrawImage player, x, y
End
End


I cannot recognize what code is missing here.

Help loading image,
Gerald


Pakz(Posted 2015) [#4]
I use the blog myself to copy and paste into monkey. I have almost no monkey files on my pc. I work With one project.

If i have made no mistakes in the blog then everything should work in glfw, html5 and flash. I compile it to these when making things.

Monkey needs more code for it to work compared to blitz. I copy and paste a template into monkey or copy other code in it when i am going to make something. It is a more difficult language. But i have programmed in assembler on the amiga and monkey is so much more easy then that.

I am not on a dev machine now so i can not look at what is wrong with the code. I wil look later if i have some time.

Some beginner tips that i learned.
The font needs to be put with the monkey executable in the data folder. Except with the flash target. The programs do not work without this data folder except flash.
When using setcolor and drawtext in html5 and a color other then 255,255,255 will slow down the program a lot.

Nice to know that my blog is useful :)

Oh and the monkey arrays are a difficult thing to get used to.


therevills(Posted 2015) [#5]
It does paste and build but the result does not run? It doesn't load the png picture.


Does it fully compile? What does it say in the output log? Have you got the png in the current data folder?


steve_ancell(Posted 2015) [#6]
@gerald:

In the same folder where you created the monkey file, have you also created a data folder?.

For example, if you have a monkey file named boing.monkey then you will need to create a folder named boing.data and then put pictures and other loadable stuff into there.

I hope this helps.


steve_ancell(Posted 2015) [#7]
Just leave the player = LoadImage ("boing.png") as it is, the path "boing.data\boing.png" will fail.

If you create a subfolder inside boing.data, let's call it "graphics", you would uses it as follows; again without typing "boing.data\":

player = LoadImage ("graphics\boing.png")

The compiler automatically sniffs out the "boing.data" path, but it's important that the folder name reflects the filename of the boing.monkey folder.