Meg
New member
- Joined
- Mar 5, 2019
- Messages
- 23
Hi Guys,
I'm struggling to make my introduction screen interactable. I have created an image and already included the buttons. Is there a way of marking the position of the buttons so that when the user hovers over that space it will show up as a button and will be able to click it?
This is my code
And I have also attached the picture
I'm struggling to make my introduction screen interactable. I have created an image and already included the buttons. Is there a way of marking the position of the buttons so that when the user hovers over that space it will show up as a button and will be able to click it?
This is my code
Code:
Import mojo
Global Game:Adventure
Function Main:Int()
Game = New Adventure ()
End Function
'--------------------------------------------------------------------------
'Class for the GAME
Class Adventure Extends App
Field image:Image
Method OnCreate:Int()
'This will run ONCE as soon as the instance of the class is created in here you can load all the start up images AND your INTRO screen and sound files.
SetUpdateRate 60
'Image- Setting dimentions so that the inage fits the screen --------
image = LoadImage ("main.png")
' create an array for that image
Local pixels:Int[image.Width * image.Height]
' draw the color red in the pixels array
For Local i:Int = 0 Until image.Width * image.Height
pixels[i] = argb(200,0,0)
Next
' copy the array to the image
image.WritePixels(pixels, 0, 0, image.Width, image.Height, 0)
Return 0
End Method
'--------------------------------------------------------------------------
Method OnUpdate:Int()
'This will be called as manny times as you wish and it will handle your inputs and the movments of your sprites
Return 0
End Method
'--------------------------------------------------------------------------
Method OnRender:Int()
'All drawing commands this is the only place that they can be called in.
'Beckground colour - BLACK-------------------------------------------------
Cls 0,0,0
'Setting the image dimentions + position-----------------------------------
DrawImage(image, 0,40)
SetColor 255,255,255
'DrawText "Image Width is : "+image.Width+" Image Height is : "+image.Height,0,0
End Method
'--------------------------------------------------------------------------
Method OnLoading:Int()
'You can also drawing commands in here however they will be called on loading insted of on render.
Return 0
End Method
'--------------------------------------------------------------------------
Method OnSuspend:Int()
'Method you called when the app is suspended, when you go off the app but the app is still running in the background.
Return 0
End Method
'--------------------------------------------------------------------------
Method OnResume:Int()
'Method called up when you resume playing the app
Return 0
End Method
'--------------------------------------------------------------------------
End
'Function for the image resizing -----------------------------------------------
Function argb:Int(r:Int, g:Int, b:Int ,alpha:Int=255)
Return (alpha Shl 24) | (r Shl 16) | (g Shl 8) | b
End Function
And I have also attached the picture