Wednesday, June 23, 2021

【GAMEMAKER】Conversation Box

 Information about object: obj_playah

Sprite: spr_playah
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.myname = get_string("Enter your name","Playah")
Step Event:
execute code:

if keyboard_check(vk_right) && place_free(x+4,y) { x += 4 }
if keyboard_check(vk_up) && place_free(x,y-4) { y -= 4 }
if keyboard_check(vk_left) && place_free(x-4,y) { x -= 4 }
if keyboard_check(vk_down) && place_free(x,y+4) { y += 4 }

zInformation about object: obj_listen
Sprite: spr_playah
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_wall_vert
Sprite: spr_wall_vert
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_wall_hor
Sprite: spr_wall_hor
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_man_yel
Sprite: spr_man_yel
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

name = "Yellow"
Alarm Event for alarm 0:
execute code:

with obj_listen instance_change(obj_playah,0)
Collision Event with object obj_playah:
execute code:

with obj_playah {
x = xprevious
y = yprevious
instance_change(obj_listen,0)
}

scr_addline(name +": Why'd u bump me?",c_yellow)
scr_addline(global.myname +": cuz I felt like it",c_lime)
scr_addline(name +": you wanna fight?",c_yellow)
scr_addline(global.myname +": forget it ever happened",c_lime)

alarm[0] = room_speed
//wait 1 second before returning character to original state

Information about object: obj_man_red
Sprite: spr_man_red
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

name = "Blue: "
Alarm Event for alarm 0:
execute code:

scr_addline(global.myname +": I'm sorry",c_lime)
alarm[1] = room_speed
Alarm Event for alarm 1:
execute code:

scr_addline(name +"you'd better be...",c_red)
alarm[2] = room_speed
Alarm Event for alarm 2:
execute code:

scr_addline(global.myname +": I am",c_lime)

with obj_listen instance_change(obj_playah,0)
Collision Event with object obj_playah:
execute code:

with obj_playah {
 x = xprevious
  y = yprevious
   instance_change(obj_listen,0)
   }
   
scr_addline(name +"Why'd you bump me?",c_red)

alarm[0] = room_speed


Information about object: obj_man_blu
Sprite: spr_man_blu
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

name = get_string("What will blue's name be?","Blue")
Collision Event with object obj_playah:
execute code:

with obj_playah {
x = xprevious
y = yprevious
instance_change(obj_listen,0)
}

timeline_index = timeline_talk_blu
timeline_position = 0
timeline_speed = 1

Information about object: obj_texty
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.lines = 4

scr_floodtexty("",c_lime)
Step Event:
execute code:

x = view_xview
y = view_yview + view_hview - (16 * global.lines)
Draw Event:
execute code:

draw_set_color(c_black)
draw_rectangle(x,y,x+view_wview,y + (16 * global.lines),0)
draw_set_color(c_fuchsia)
draw_rectangle(x,y,x+view_wview,y + (16 * global.lines),1)

//draw_set_font(fnt_courier)

for (t=global.lines-1; t>-1; t-=1) {
 draw_set_color(global.textcol[t])
  draw_text(x+4,y+1+(((global.lines - 1)-t)*16),global.texty[t])
  }

Information about object: object8
Sprite: sprite6
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Alarm Event for alarm 0:
execute code:

game_end()
Collision Event with object obj_playah:
execute code:

with other {
x = xprevious
y = yprevious
instance_change(obj_listen,0)
}

scr_addline(global.myname +" has left the room",c_white)
alarm[0] = room_speed * 2

//adds a line to texty
//argument0 is the new text to be added
//argument1 is the color for the text to be displayed in




for (m = global.lines-1; m > 0 ; m -= 1) {
 global.texty[m] = global.texty[m-1]
global.textcol[m] = global.textcol[m-1]
}

global.texty[0] = argument0
global.textcol[0] = argument1

//floods texty (fills it up with the same thing)
//argument0 is the text to flood the box with.
//An empty string clears the box
//argument1 is the color to flood the box with.

for (m = 0; m < global.lines; m += 1) {
global.texty[m] = argument0
global.textcol[m] = argument1
}

No comments:

Post a Comment

End of Summer Sale ☀️😎

20% OFF Inside!🤯 ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏...